user4604792
user4604792

Reputation:

SQLite Database Column Error

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,"+KEY_PASS+" TEXT,"+KEY_CONTACT+" TEXT,"+KEY_GENDER+" TEXT,"+KEY_LOCATION+" TEXT," +KEY_SALARY+" TEXT,"+KEY_JOBAREA+" TEXT,"+KEY_DIET+" TEXT,"+KEY_DRINK+" TEXT,"+KEY_DOB+" TEXT,"+KEY_RELIGION+ " TEXT,"+KEY_EDUCATION+" TEXT,"+KEY_DETAIL+" TEXT,"+KEY_PHOTO+" BLOB,"+KEY_CODE+" TEXT,"+KEY_ACTIVE+" TEXT"+")"; And the Error is : table Profiles has no column named userGender 04-14 03:31:51.815 4595-4595/com.example.appify.matrimonio E/SQLiteDatabase: Error inserting userName=Natasha [email protected] userGender=bride userContact=5555 userPass=natasha android.database.sqlite.SQLiteException: table Profiles has no column named userGender (code 1): , while compiling: INSERT INTO Profiles(userName,userEmail,userGender,userContact,userPass) VALUES (?,?,?,?,?) at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method) at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889) at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500) at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588) at android.database.sqlite.SQLiteProgram.(SQLiteProgram.java:58) at android.database.sqlite.SQLiteStatement.(SQLiteStatement.java:31) at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1467) at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1339) at helper.DatabaseHelper.addProfile(DatabaseHelper.java:84) at com.example.appify.matrimonio.MainActivity.onCreate(MainActivity.java:32) at android.app.Activity.performCreate(Activity.java:5249) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2165) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2250) at android.app.ActivityThread.access$900(ActivityThread.java:141) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1213) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5072) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609) at dalvik.system.NativeStart.main(Native Method) 04

Upvotes: 0

Views: 46

Answers (1)

Rajesh
Rajesh

Reputation: 87

if you changed your table structure, increment value of your database version. surely it will work.

Upvotes: 0

Related Questions