I have application where user enters name and other details for specific date. I need to check whether value/name user is trying to add exists already in the database column name. I have this code but this doesn’t work as it selects only one value. Thanks
Cursor c = dbe.rawQuery("SELECT name FROM tbl_user WHERE meeting_date LIKE'" + mydate + "'", null);
if ((c.getString(3)).equals(editTextName.getText().toString()))
{
// do something
}
If you are only checking for existence of a value in a field, the easiest way is to do a select count with the appropriate filter.
Something along the lines of
this would allow you to easily and quickly determine if those value exist in your table.
If you need to check multiple tables, then you would have to do a join between those tables and write your filter accordingly.
If by chance you don’t have a good handle on SQL.
This site is a good starting place:
W3Schools SQL Tutorial
Hope this helps.