hi i am new to andriod.I am creating a table and inserting the values into table by using sql lite.Now i need to change vales based on the id.how can i done this pls post some code.Thank u in advance.
i need it in android sql lite,not in sql
MaheshBabu
2010-10-11 08:36:40
A:
You need to use SQLiteDatabase.update method. Method will return number of rows affected. In your case it should be a single row.
public int update(int id, ContentValues values, SQLiteDatabase db){
String selection = ID_COLUMN_NAME + "=" + Integer.toString(id);
count = db.update(TABLE_NAME, values, selection, null);
return count;
}
http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#update(java.lang.String, android.content.ContentValues, java.lang.String, java.lang.String[]
p.s. sorry, StackOverflow corrupts the url
cement
2010-10-11 08:37:42