开发者

Android SQL Update statement

开发者 https://www.devze.com 2023-03-23 09:38 出处:网络
Can anyone tell me where I am going wrong with this SQL Update statement please? SQLiteDatabase hashDB = openOrCreateDatabase(HASH_DB, MODE_PRIVATE, null);

Can anyone tell me where I am going wrong with this SQL Update statement please?

SQLiteDatabase hashDB = openOrCreateDatabase(HASH_DB, MODE_PRIVATE, null);

hashDB.execSQL("CREATE TABLE IF NOT EXISTS " + HASH_TABLE1 + " (FileName VARCHAR, Hash VARCHAR);");


ContentValues updateFilesTable = new ContentValues();
updateFilesTable.put("Hash", hash);
hashDB.update(HASH_TABLE1, updateFilesTable, "FileName" + "=" + file, null);

file and hash are both Strings and I know they have the correct data in them, the records I am trying to update definitely exist in the database. HASH_TABLE1 also points开发者_运维知识库 to the correct table.

Many Thanks

Matt


You aren't quoting the file string. You want this line to read:

hashDB.update(HASH_TABLE1, updateFilesTable, "FileName = ?", new String[] { file });
0

精彩评论

暂无评论...
验证码 换一张
取 消