views:

18

answers:

1

I'm trying to create a table in android database, but when i try to run the application the LogCat returns the following error:

08-22 02:39:29.098: ERROR/AndroidRuntime(277): Caused by: android.database.sqlite.SQLiteException: near "auto_increment": syntax error: CREATE TABLE words(id INTEGER PRIMARY KEY, word TEXT, count INTEGER not null auto_increment)

The code for this error is this:

public void onCreate(SQLiteDatabase db) {
     db.execSQL("CREATE TABLE " + TABLE_NAME + "(id INTEGER PRIMARY KEY, word TEXT, count INTEGER not null auto_increment)");
  }

And there is a error on this line too, the one between arrows:

public DataHelper(Context context) {
  this.context = context;
  OpenHelper openHelper = new OpenHelper(this.context);
  -->this.db = openHelper.getWritableDatabase();<--
  this.insertStmt = this.db.compileStatement(INSERT);
  this.updateStmt = this.db.compileStatement(UPDATE);

}

Ps: The codes before is from DataHelper class.

and erro at this line (the logcat just say the line of the class, dont say the error):

this.dh = new DataHelper(this);     

Ps: DataHelper is the class that manage the database.

+1  A: 

Change auto_increment to autoincrement and you should be good. Simple syntax error :)

smith324