Have a Database with various table. I need to update a String value in table1.
I have a string in activity1.And passed the String value to DBhelper from Activity1.Like this.
private void goTokey() {
check="premium";
dbHelper=new DBHelper(this);
dbHelper.sample(check);
}
I got a value in DBHelper and I need to update that value in database in table1.
DBHelper.class
public void sample( String prms) {
Log.d("DBHELPER SUCCESS", prms);
try{
SQLiteDatabase db1 = this.getWritableDatabase();
db1.execSQL("update table1 SET status = '"+prms+"' WHERE id = 1 ");
}catch(Exception e){
System.out.println("GET SAMPLE VALUE"+e);
}
}
For reference of DBHelper.class view here
What's wrong with my syntax?
I got exception like this from some where..
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)
How to achieve this to update the value into database?