android - Running a raw sqlite query -


I'm trying to run this query but it just is not working and I can not find that What is wrong this

  Public Boolean verified user (string name, string page) {Boolean result = false; SQLiteDatabase db = this.getReadableDatabase (); {Cursor res = db.rawQuery ("Choose user from user where username =" + name + "and password =" + pword + "", null); Int count = res.getCount (); Res.moveToFirst (); If (calculation == 0) {result = false; } And {result = true; }} Catch (from SQLiteException) {Logclass (). GetSimpleName (), "can not be logged"); } Return results; // return true; }     

In SQL, you must enter your string literals in the single quote '. Better yet, use the parameters:

  cursor res = db.rawQuery ("Choose from user where * username =? And password =?", New string [] {name, pword });  

Comments