mercredi 15 avril 2015

How to check value of column exist or not in sqlite android?

This is my code:



public boolean checkIDTraLoiBangID(int Id){
boolean check = false;
String query = "select IDTraLoi from BangCauHoi where ID=?";
Cursor c = database.rawQuery(query, new String[] { "" + Id });
if (c != null && c.moveToFirst())
{
check = true;
}
c.close();
return check;
}


I'm trying to check value of IDTraLoi exist or not follow where clause. But, even in column IDTraLoi have no value this function still return true.


Somebody can help me please? Thank you and sorry because my english...


Aucun commentaire:

Enregistrer un commentaire