0

这应该是一个非常简单的任务,但我已经卡了一个小时。

我在sqlite 浏览器中尝试了这个查询,它的工作原理

SELECT name FROM msUser WHERE username='admin' AND password='admin'

但是当我在 Java 代码中尝试这个时,它不是 wokring :

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

4

1 回答 1

2

尝试这个:

querySelect = "SELECT name FROM " + TABLE_NAME + " WHERE username = '" + username + "' AND password = '" + password +"'";
于 2013-01-19T07:37:27.007 回答