lundi 22 juin 2015

(Using the WHERE clause in SQLite) SQLiteException: near "=": syntax error (code 1):

I Have code SQLite, but this code not worker in my app

error

SQLiteException: near "=": syntax error (code 1): , while compiling: SELECT * FROM tabellirikWHERE kategori=Pupuh Ginada

and this mya code

 public ArrayList<Lirik> getAllLirik2(){
    ArrayList<Lirik> arrayList = new ArrayList<Lirik>();
    SQLiteDatabase db = this.getReadableDatabase();
    Cursor cursor = db.rawQuery("SELECT * FROM "+ TABLE_MUPUH + "WHERE " + KATEGORY_LIRIK + "=" + "Pupuh Ginada ", null);
    cursor.moveToFirst();
    while (cursor.isAfterLast()==false){
        Lirik lirik = new Lirik(
                cursor.getInt(cursor.getColumnIndex(KEYL_ID)),
                cursor.getString(cursor.getColumnIndex(KATEGORY_LIRIK)),
                cursor.getString(cursor.getColumnIndex(JUDUL)),
                cursor.getString(cursor.getColumnIndex(KEY_MUPUH))
        );
        arrayList.add(lirik);
        cursor.moveToNext();
    }

    return arrayList;
}

help me, thanks

Aucun commentaire:

Enregistrer un commentaire