dimanche 2 août 2015

SQLite android database syntax error

I'm trying to create SQLite databse, but I get this error

android.database.sqlite.SQLiteException: near "TO": syntax error (code 1): , while compiling: CREATE TABLE INFO (_id INTEGER PRIMARY KEY AUTOINCREMENT, TO TEXT, FROM TEXT, HEADING TEXT, BODY TEXT);

Here how I create my database

@Override
    public void onCreate(SQLiteDatabase db) {
        //CREATE TABLE INFO (_id INTEGER PRIMARY KEY AUTOINCREMENT, TO TEXT, FROM TEXT, HEADING TEXT, BODY TEXT);
        db.execSQL("CREATE TABLE " + Constants.TABLE_NAME + " (_id INTEGER PRIMARY KEY AUTOINCREMENT, " + Constants.TO + " TEXT, " + Constants.FROM + " TEXT, " + Constants.HEADING + " TEXT, " + Constants.BODY + " TEXT);");
    }

So what's wrong with syntax?

Aucun commentaire:

Enregistrer un commentaire