Baqer Naqvi
Baqer Naqvi

Reputation: 6504

Sqlite Update Query not working | Android

I am new to Android apps and trying to run Sqlite-query like this;

String query = "Select IsEnabled from Translation_Language ORDER BY TransLation_Language_ID";
Cursor Translations = SplashScreen.database.rawQuery(query,null);

and it is working. But i don't know how to update the same table. I have tried some methods but failed. Could anyone help me to resolve it???

Update query code

SplashScreen.database.update("Translation_Language", "IsEnabled", "TransLation_Language_ID", new String[] {"1", "8"});

I want to set IsEnabled property to 1 that have ID=8.

Upvotes: 0

Views: 1379

Answers (1)

M D
M D

Reputation: 47807

try this way:

 ContentValues cv = new ContentValues(); 
 cv.put("IsEnabled","1");  
 db.update("Translation_Language", cv, "TransLation_Language_ID=?", new String[] { "8" });

Upvotes: 2

Related Questions