Currently having an issue in my SQLite database in android, when I try and run a comparison I get the following error: Caused by: android.database.sqlite.SQLiteException: near "@hotmail": syntax error: , while compiling: SELECT DISTINCT _id, userName, password FROM userTable WHERE [email protected] password=shshsh
my search is:
public boolean getUserNameAndPassword(String userName, String Password) throws SQLException {
Cursor mCursor =
db.query(true, TABLE_NAME, new String[] {KEY_ROWID,USER,
PWD},USER + "=" + userName + "AND password=" + Password, null,
null, null, null, null);
if (mCursor.getCount() > 0)
{
return true;
}
return false;}
My attempt to run it is:
boolean signIn = dbHelper.getUserNameAndPassword(mEmail, mPassword);
if (signIn){
Toast.makeText(getBaseContext(),"Sign in successful",Toast.LENGTH_LONG).show();
}else {Toast.makeText(getBaseContext(),"Sign in failed",Toast.LENGTH_LONG).show();}
Thanks in advance!
selectionArgsand?.