我还在学习 Android开发,我在创建一个sqlite数据库表时遇到了问题.这是我的代码的一部分: ` private static final String CREATE_ADS_PICTURE = "CREATE TABLE " + AdsBDD.TABLE_ADS_PICTURE + "(" + AdsBDD.ID_PICS + "
`
private static final String CREATE_ADS_PICTURE = "CREATE TABLE " + AdsBDD.TABLE_ADS_PICTURE + "(" + AdsBDD.ID_PICS + " INTEGER PRIMARY KEY AUTOINCREMENT ," + AdsBDD.AD_ID + " INTEGER NOT NULL," + AdsBDD.PICTURE + " TEXT," + AdsBDD.FOLDER + " TEXT," + AdsBDD.ORDER_NO + " INTEGER NOT NULL);"; private static final String CREATE_AGENCES = "CREATE TABLE " + AgencesBDD.TABLE_AGENCES + "(" + AgencesBDD.ID + " INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL," + AgencesBDD.GROUP + " INTEGER," + AgencesBDD.USERNAME + " TEXT," + AgencesBDD.EMAIL + " TEXT," + AgencesBDD.CONTACT_NAME + " TEXT," + AgencesBDD.REGISTRATION_DATE + " TEXT," + AgencesBDD.ACTIVATION + " TEXT," + AgencesBDD.ACTIVE + " INTEGER," + AgencesBDD.STORE + " INTEGER," + AgencesBDD.STORE_BANNER + " TEXT," + AgencesBDD.RATING + " REAL," + AgencesBDD.LANGUAGE + " TEXT," + AgencesBDD.IDENTITY + " TEXT," + AgencesBDD.ADDRESS + " TEXT," + AgencesBDD.PHONE + " TEXT," + AgencesBDD.COMPANY + " TEXT," + AgencesBDD.WEBPAGE + " TEXT," + AgencesBDD.CODE_POSTAL + " TEXT," + AgencesBDD.JE_SUIS_UN + " TEXT," + AgencesBDD.VILLE + " TEXT," + AgencesBDD.VIDEO + " TEXT);"; @Override public void onCreate(SQLiteDatabase db) { db.execSQL(CREATE_ADS_PICTURE); db.execSQL(CREATE_AGENCES); } public class AgencesBDD { public static final String TABLE_AGENCES = "agences"; public static final String ID = "id"; public static final String GROUP = "group"; public static final String USERNAME = "username"; public static final String EMAIL = "email"; public static final String CONTACT_NAME = "contact_name"; public static final String REGISTRATION_DATE = "registration_date"; public static final String ACTIVATION = "activation"; public static final String ACTIVE = "active"; public static final String STORE = "store"; public static final String STORE_BANNER = "store_banner"; public static final String RATING = "rating"; public static final String LANGUAGE = "language"; public static final String IDENTITY = "identity"; public static final String ADDRESS = "address"; public static final String PHONE = "phone"; public static final String COMPANY = "company"; public static final String WEBPAGE = "webpage"; public static final String CODE_POSTAL = "code_postal"; public static final String JE_SUIS_UN = "je_suis_un"; public static final String VILLE = "ville"; public static final String VIDEO = "video";
`
所以问题是Sqlite为表AGENCES抛出了这个异常,但表AD_PICTURE工作正常:
03-08 14:36:01.892: E/AndroidRuntime(10822): FATAL EXCEPTION: main 03-08 14:36:01.892: E/AndroidRuntime(10822): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.infonetdiffusion.immohabitation/com.infonetdiffusion.immohabitation.FragmentBaseActivity}: android.database.sqlite.SQLiteException: near "group": syntax error (code 1): , while compiling: CREATE TABLE agences(id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,group INTEGER,username TEXT,email TEXT,contact_name TEXT,registration_date TEXT,activation TEXT,active INTEGER,store INTEGER,store_banner TEXT,rating REAL,language TEXT,identity TEXT,address TEXT,phone TEXT,company TEXT,webpage TEXT,code_postal TEXT,je_suis_un TEXT,ville TEXT,video TEXT);
它应该很容易修复,但我找不到我错了…
任何帮助将是apreciated!