SQLite数据库列错误

时间:2016-04-13 21:57:50

标签: android-sqlite

private static final String CREATE_TABLE_PROFILES =" CREATE TABLE IF NOT EXISTS" + TABLE_PROFILES +"(" + KEY_PROFILE_ID +" INTEGER PRIMARY KEY,"             + KEY_NAME +" TEXT," + KEY_EMAIL +" TEXT,&#34 + + KEY_PASS" TEXT,&#34 + + KEY_CONTACT" TEXT,&#34 + + KEY_GENDER" TEXT,&#34 + + KEY_LOCATION" TEXT,"             + KEY_SALARY +" TEXT,&#34 + + KEY_JOBAREA" TEXT,&#34 + + KEY_DIET" TEXT,&#34 + + KEY_DRINK" TEXT,&#34 + + KEY_DOB" TEXT,&#34 + + KEY_RELIGION             " TEXT,&#34 + + KEY_EDUCATION" TEXT,&#34 + + KEY_DETAIL" TEXT,&#34 + + KEY_PHOTO" BLOB,&#34 + + KEY_CODE" TEXT,&#34 + + KEY_ACTIVE" TEXT" +&#34)&#34 ;; 错误是: table Profiles没有名为userGender的列 04-14 03:31:51.815 4595-4595 / com.example.appify.matrimonio E / SQLiteDatabase:插入userName时出错= Natasha userEmail=Natasha@gmail.com userGender = bride userContact = 5555 userPass = natasha                                                                              android.database.sqlite.SQLiteException:table Profiles没有名为userGender的列(代码1):,编译时:INSERT INTO配置文件(userName,userEmail,userGender,userContact,userPass)VALUES(?,?,?,?,?)                                                                                  在android.database.sqlite.SQLiteConnection.nativePrepareStatement(本机方法)                                                                                  在android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889)                                                                                  在android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500)                                                                                  在android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)                                                                                  在android.database.sqlite.SQLiteProgram。(SQLiteProgram.java:58)                                                                                  在android.database.sqlite.SQLiteStatement。(SQLiteStatement.java:31)                                                                                  在android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1467)                                                                                  在android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1339)                                                                                  at helper.DatabaseHelper.addProfile(DatabaseHelper.java:84)                                                                                  在com.example.appify.matrimonio.MainActivity.onCreate(MainActivity.java:32)                                                                                  在android.app.Activity.performCreate(Activity.java:5249)                                                                                  在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)                                                                                  在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2165)                                                                                  在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2250)                                                                                  在android.app.ActivityThread.access $ 900(ActivityThread.java:141)                                                                                  在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1213)                                                                                  在android.os.Handler.dispatchMessage(Handler.java:102)                                                                                  在android.os.Looper.loop(Looper.java:136)                                                                                  在android.app.ActivityThread.main(ActivityThread.java:5072)                                                                                  at java.lang.reflect.Method.invokeNative(Native Method)                                                                                  在java.lang.reflect.Method.invoke(Method.java:515)                                                                                  在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:793)                                                                                  在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)                                                                                  at dalvik.system.NativeStart.main(Native Method) 04

1 个答案:

答案 0 :(得分:0)

如果更改了表结构,则增加数据库版本的值。 肯定会有用。