dimanche 27 décembre 2015

Syntax error when attempting to use SQLite query to create table in android

I am trying to execute a String query but it is giving me a syntax error as shown:

android.database.sqlite.SQLiteException: near ")": syntax error (code 1): , while compiling: CREATE TABLE Enter (_id INTEGER PRIMARY KEY,_audio_id TEXT, )

I've checked multiple times with http://ift.tt/1wICCWB and it matches but I'm not sure why it doesn't work. My query is as shown:

public void CreatePlaylist(String name){
        SQLiteDatabase db=getWritableDatabase();
        String query="CREATE TABLE "+ name +" (" +
                COLUMN_ID + " INTEGER PRIMARY KEY," +
                COLUMN_AUDIO_ID + " TEXT,"+
                " )";
                System.out.println("DB "+db);
        db.execSQL(query);
    }

Is there anything wrong with my query?

Thanks

Aucun commentaire:

Enregistrer un commentaire