This is my code:
public int getIdMotChuDe(String tenChuDe) {
int IDChuDe = 0;
try
{
Cursor c = null;
c = database.rawQuery("SELECT ChuDeID FROM DanhSachChuDe WHERE TenChuDe = ?", new String[] {tenChuDe});
c.moveToFirst();
IDChuDe = c.getInt(c.getColumnIndex("ChuDeID"));
c.close();
}
catch(Exception e)
{
e.printStackTrace();
}
return IDChuDe;
}
I'm trying to get ChuDeID
from DanhSachChuDe
table with condition in WHERE clause. But i don't know why this function always return 0
. Help me please. Thanks! Sorry because my english.
Aucun commentaire:
Enregistrer un commentaire