我想運行這個查詢,但它只是不工作,我似乎無法找到它有什麼問題。運行原始的sqlite查詢
public boolean verifyUser(String name , String pword){
boolean result = false;
SQLiteDatabase db = this.getReadableDatabase();
try {
Cursor res = db.rawQuery("select * from user where username="+name+" and password="+pword+"", null);
int count = res.getCount();
res.moveToFirst();
if (count == 0)
{
result = false;
}
else{
result = true;
}
}
catch (SQLiteException se) {
Log.e(getClass().getSimpleName(), "Could not log in");
}
return result;
//return true;
}
當值包含一個引號時,這將爆炸。 – 2014-10-27 12:59:57
試過這個,但不知何故我的程序仍然崩潰。有沒有辦法通過命令提示符查看數據庫中發生了什麼?我正在使用eclipse – thesma 2014-10-27 13:01:35
@CL請澄清請 – nobalG 2014-10-27 13:05:36