I'm new to Android SQLite. I've created the table name "Registration":
id FirstName LastName UserName Password Mobile
0 Rakesh L rocky pw123 9600956892
1 Ramesh S ram wckt123 9600634845
2 Vignesh A vicky vky123 9380930489
3 Balaji B bala ball123 9597735613
If I register again with the same username and password, it must show the Toast. I've tried the following snippet .But i failed to succeed.
DBHelper.getReadableDatabase();
Cursor mCursor = db.rawQuery("SELECT * FROM " + DATABASE_TABLE + " WHERE username=? AND password=?", new String[]{username,password});
if (mCursor != null) {
if(mCursor.getCount()!=0)
{
return true;
}
}
return false;
}
Please help me with code snippets.