dimanche 4 octobre 2015

getting error : Caused by: android.database.sqlite.SQLiteException: near "TABLENAME" syntax error (code 1) compiling a SELECT query

I'm getting the following error while compiling a SELECT query:

Caused by: android.database.sqlite.SQLiteException: near "group": syntax error (code 1): , while compiling: SELECT group_id, logo FROM group WHERE group_name = 'Empty Group'

The query is created as:

c = database.query(TABLE_GROUP, new String[]{KEY_GROUPID, KEY_LOGO}, KEY_GROUPNAME + " = '" + description + "'", null, null, null, null);

with:

TABLE_GROUP = "group";
KEY_LOGO = "logo";
KEY_GROUPID = "group_id";

and the creation script for the table:

create table group 
(group_id integer primary key autoincrement, 
group_name text not null, 
logo string);

Anyone knows what's wrong?

Aucun commentaire:

Enregistrer un commentaire