mardi 27 janvier 2015

Android sqlite syntax error: near ")"

I got error for creating sqlite db in android.


My code is:



public static final String TABLE_NAME = "user";
public static final String COL1_USER_ID = "USER_ID";
public static final String COL2_USER_NAME = "USER_NAME";
public static final String COL3_IMEI_CODE = "IMEI_CODE";
public static final String COL4_REGISTRATION_ID = "REGISTRATION_ID";
public static final String COL5_MOBILE_NUMBER = "MOBILE_NUMBER";

public static final String CREATE_TABLE = "CREATE TABLE " + TABLE_NAME + "(" + _ID + " INTEGER PRIMARY KEY,"+ COL1_USER_ID + TEXT_TYPE + COMMA_SEP + COL2_USER_NAME + TEXT_TYPE
+ COMMA_SEP + COL3_IMEI_CODE + TEXT_TYPE + COMMA_SEP + COL4_REGISTRATION_ID + VARCHAR_TYPE + COMMA_SEP + COL5_MOBILE_NUMBER + TEXT_TYPE + COMMA_SEP + ")";


Error message is:



android.database.sqlite.SQLiteException: near ")": syntax error (code 1): , while compiling: CREATE TABLE user(_id INTEGER PRIMARY KEY,USER_ID TEXT,USER_NAME TEXT,IMEI_CODE TEXT,REGISTRATION_ID VARCHAR(255),MOBILE_NUMBER TEXT,)


How to solve this?


Aucun commentaire:

Enregistrer un commentaire