我想从我的APP中的SQLite数据库中获取查询,包括姓名,用户名和密码。
public String Login(String Username, String Password) {
String Q = "SELECT * FROM " + DBHelper.TBLname + " WHERE "
+ DBHelper.ColumnUser + " = " + Username
+ " AND " + DBHelper.ColumnPass + " = " + Password;
Cursor LoginQuery = MyDB.rawQuery(Q, null);
if (LoginQuery == null) {
LoginQuery.close();
String LoginResult = "Wrong User Name and Password";
return LoginResult;
}
LoginQuery.moveToFirst();
String LoginResult = LoginQuery.getString(3);
LoginQuery.close();
return LoginResult;
}
答案 0 :(得分:0)
不使用dbhelper尝试此操作:
SELECT * FROM YOUR TABLE WHERE Username=Your Username AND Password=Your Password