lundi 14 décembre 2015

How to perform select query on integer field in SQLite, Android?

SQLiteDatabase database = this.getReadableDatabase();
        Cursor cursor = database.rawQuery(selectAll + DatabaseSchema.Vehicles.TABLE_NAME + " where " + DatabaseSchema.Vehicles.COLUMN_ID + "=" + id, null);
        cursor.moveToFirst();

Here, selectAll = "select * from ", and COLUMN_ID is has int datatype. This code returns an empty cursor everytime. Even though data is inserted in table. When I run query with only "select * from tablename". It gives me data.

Aucun commentaire:

Enregistrer un commentaire