我想帮助我在我的应用程序中查找SQL查询的错误。
//update pass in db
SQLiteDatabase db = dbHelper.getWritableDatabase();
String query = " UPDATE " + Password.TABLE + " SET " + Password.KEY_NAME + "='" + newName + "'," +
Password.KEY_URL + "='" + newUrl + "'," +
Password.KEY_USER + "=" + newUser + Password.KEY_PASS + "=" + newPass+"'," + " WHERE " + Password.KEY_NAME + "='" + oldName + "' AND " +
Password.KEY_URL + " = '" + oldUrl + "';" ;
db.execSQL(query);
db.close(); //closing db connection
答案 0 :(得分:0)
您的,
之前还有一个额外的WHERE
。试试:
String query = " UPDATE " + Password.TABLE + " SET " + Password.KEY_NAME + "='" + newName + "'," +
Password.KEY_URL + "='" + newUrl + "'," +
Password.KEY_USER + "=" + newUser + Password.KEY_PASS + "=" + newPass+"' " + " WHERE " + Password.KEY_NAME + "='" + oldName + "' AND " +
Password.KEY_URL + " = '" + oldUrl + "';" ;