I'm checking if a sqlLite table record is available or not , it's giving me that the record is available even if it's not
public void checkIfExcist(Context mCtx, String recordName, String ValueCheck) {
DatabaseHelper mDbHelper = new DatabaseHelper(mCtx);
SQLiteDatabase mDb = mDbHelper.getWritableDatabase();
Cursor mCursor = mDb.rawQuery("SELECT * FROM " + SQLITE_TABLE
+ " WHERE " + recordName + " ='" + ValueCheck + "'", null);
if (mCursor != null) {
Toast.makeText(mCtx, "Available", 3000).show();
/* record exist */
} else {
Toast.makeText(mCtx, "Not Available", 3000).show();
/* record not exist */
}
}
Aucun commentaire:
Enregistrer un commentaire