Have a database with table name status
and column name is column1
. I need to update this.
I have a String value in Activity1
String check = "value";
I have passed this value into my DBHelper
.I have tried like this
dbhelper = new DBHelper(this);
dbhelper.sample(check);
I got this value in DBHelpe
r.here. Like this
public void sample(String prms){
Log.d("sucess",prms);
}
Now how i need to update String prms
into my database columnname column1
I have tried like this
public void sample( String prms) {
Log.d("DBHELPER SUCCESS", prms);
try{
SQLiteDatabase db1 = this.getWritableDatabase();
db1.execSQL("update appstatus SET status = '"+prms+"' WHERE id = 1 ");
}catch(Exception e){
System.out.println("GET SAMPLE VALUE"+e);
}
}
What's wrong with my syntax? How to achieve this?
It shows exception as
02-28 12:09:45.604: I/System.out(4975): GET SAMPLE VALUEandroid.database.sqlite.SQLiteException: table report already exists (code 1): , while compiling: create table report(level TEXT, topic TEXT, start TEXT, end TEXT, date TEXT)