这应该是一项非常简单的任务,但我已经被困了一个小时。
我在 sqlite浏览器中尝试了此查询,其工作:
SELECT name FROM msUser WHERE username='admin' AND password='admin'
但是当我在Java代码中尝试这个时,它并没有意味着:
querySelect = "SELECT name FROM " + TABLE_NAME + " WHERE username = " + username + " AND password = " + password;
这就是日志猫所说的:
01-19 14:21:02.279: E/AndroidRuntime(3117): android.database.sqlite.SQLiteException: no such column: admin: , while compiling: SELECT name FROM msUser WHERE username = admin AND password = admin
请帮助我,谢谢:D
答案 0 :(得分:2)
试试这个:
querySelect = "SELECT name FROM " + TABLE_NAME + " WHERE username = '" + username + "' AND password = '" + password +"'";