2010-10-11 33 views
0

嗨,我是新來的andriod.I創建一個表,並通過使用sql lite.Now我將需要改變值表,我需要改變vales我可以做到這一點pls張貼一些代碼。謝謝你提前。如何修改數據庫中的表值

回答

0

所以,你試過UPDATE

+0

我需要它在Android的SQL精簡版,而不是在SQL – MaheshBabu 2010-10-11 08:36:40

0

您需要使用SQLiteDatabase.update方法。方法將返回受影響的行數。在你的情況下,它應該是單行。

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.對不起,StackOverflow損壞的URL