android上的SQL查询错误 - "找不到可执行代码...."

时间:2016-01-03 17:19:08

标签: android sql

我想帮助我在我的应用程序中查找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

错误: http://postimg.org/image/xp1kvn3k5/

1 个答案:

答案 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 +  "';" ;