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 });
精彩评论