我正在嘗試檢查有效的用戶。但我發現了以下Exception
:在sqlite中檢查有效的用戶名和密碼時得到異常
no such column: ABC(Code 1):, while compiling: SELECT _id, username, password
FROM MyTable1 WHERE username=ABC
的代碼如下:
public int checkUser(String userName, String password) {
int check = -1;
int id = 2;
String psword = new String();
Cursor cursor = database.query(TABLE_NAME, allColumns, COLUMN_USER_NAME + "=" + userName, null, null, null, null);
cursor.moveToFirst();
Log.v(TAG, "After CURSOR!!");
psword = cursor.getString(cursor.getColumnIndex(COLUMN_PASSWORD));
Log.v(TAG, "pasword: " + psword);
if (psword.equals(password)) {
check = 1;
}
return check;
}
我在做什麼錯?請幫助
您是否更改過密碼 –
您是否解決了您的問題? –