Below method will search "id" value in table....you just need to pass the columName ,TableName and value in this method.......
private boolean isPresent(int id, String Table, String columnName) {
SQLiteDatabase sqdb = databaseManager.getWritableDatabase();
Cursor cur = sqdb.rawQuery("select * from " + Table + " Where "
+ columnName + "=" + id, null);
int count = cur.getCount();
if (!(count == 0)) {
cur.close();
sqdb.close();
return true;
}
cur.close();
sqdb.close();
// sdcarddb.close();
return false;
}
private boolean isPresent(int id, String Table, String columnName) {
SQLiteDatabase sqdb = databaseManager.getWritableDatabase();
Cursor cur = sqdb.rawQuery("select * from " + Table + " Where "
+ columnName + "=" + id, null);
int count = cur.getCount();
if (!(count == 0)) {
cur.close();
sqdb.close();
return true;
}
cur.close();
sqdb.close();
// sdcarddb.close();
return false;
}
No comments:
Post a Comment