I've been trying to update a specific row for a while now, and it seems that there are two ways to do this. From what I've read and tried, you can just use the:
execSQL(String sql)
method
or the:
update(String table, ContentValues values, String whereClause, String[] whereArgs)
method.
(Let me know if this is incorrect as I am new to android and very new to SQL.)
So let me get to my actual code.
myDB.update(TableName, "(Field1, Field2, Field3)" + " VALUES ('Bob', 19, 'Male')", "where _id = 1", null);
I am trying to accomplish this:
Update Field1, Field2, and Field3 where the primary key (_id) is equal to 1.
Eclipse gives me a red line right underneath the word "update" and gives me this explanation:
The method update(String, ContentValues, String, String[]) in the type
SQLiteDatabase is not applicable for the arguments (String, String,
String, null)
I'm guessing I'm not assigning the ContentValues correctly. Can anyone point me in the right direction?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…