Just replace %s
with ?
so the strImageName
bind argument is used there:
Cursor cursor = db.rawQuery("select 1 from churchTable where ImageName=?",
new String[] { strImageName });
Frage
How to check if record exist with ImageName or not into database table, I am using below code to check that ?
// Check for Record using ImageName
public boolean Exists(String strImageName) {
SQLiteDatabase db;
db = this.getReadableDatabase(); // Read Data
Cursor cursor = db.rawQuery("select 1 from churchTable where ImageName=%s",
new String[] { strImageName });
boolean exists = (cursor.getCount() > 0);
cursor.close();
return exists;
}
Lösung
Just replace %s
with ?
so the strImageName
bind argument is used there:
Cursor cursor = db.rawQuery("select 1 from churchTable where ImageName=?",
new String[] { strImageName });