I'm going crazy about this. My query works if I don't use 'where', but the moment I insert 'where', it returns nothing. I'm dead sure the value specified in 'where' does exist.
here's my code that successfully returns the values:
Cursor cursor;
cursor = database.query(MySQLiteHelper.TABLE_EVENTS, new String[] {"eventName, accountType"}, null, null, null, null, null);
if (cursor.moveToFirst()) {
do {
Log.v(FILE_NAME, "eventName: " + cursor.getString(cursor.getColumnIndex("eventName")));
Log.v(FILE_NAME, "accountType: " + cursor.getString(cursor.getColumnIndex("accountType")));
} while (cursor.moveToNext());
}
here's the returned values:
01-16 18:42:39.979 V/DbHelper.java﹕
V/DbHelper.java﹕eventName: Evenesis Gathering
V/DbHelper.java﹕accountType: 1
V/DbHelper.java﹕eventName: Asia Conference
V/DbHelper.java﹕accountType: 1
but when I add the where value:
Cursor cursor;
cursor = database.query(MySQLiteHelper.TABLE_EVENTS, new String[] {"eventName, accountType"}, "accountType='1'", null, null, null, null);
if (cursor.moveToFirst()) {
do {
Log.v(FILE_NAME, "eventName: " + cursor.getString(cursor.getColumnIndex("eventName")));
Log.v(FILE_NAME, "accountType: " + cursor.getString(cursor.getColumnIndex("accountType")));
} while (cursor.moveToNext());
}
I got nothing. Have I done anything wrong?
Aucun commentaire:
Enregistrer un commentaire