-1
這個錯誤是什麼意思? 我試圖插入日期SQLite數據庫將日期插入到android中的SQLite數據庫時出錯
01-01 12:25:12.625: E/Database(412): Error inserting event_id=4 end_date=03/01/3912 12:27:38 PM event_title=test test test event_body=test test test test test test test test location=Gaza start_date=01/01/3912 12:24:38 PM
01-01 12:25:12.625: E/Database(412): android.database.sqlite.SQLiteConstraintException: error code 19: constraint failed
01-01 12:25:12.625: E/Database(412): at android.database.sqlite.SQLiteStatement.native_execute(Native Method)
01-01 12:25:12.625: E/Database(412): at android.database.sqlite.SQLiteStatement.execute(SQLiteStatement.java:61)
01-01 12:25:12.625: E/Database(412): at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1582)
01-01 12:25:12.625: E/Database(412): at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1426)
01-01 12:25:12.625: E/Database(412): at com.android.dataset.DatabaseHelper.insertAppointment(DatabaseHelper.java:74)
01-01 12:25:12.625: E/Database(412): at com.android.uis.CreateAppointmentActivity$3.onClick(CreateAppointmentActivity.java:83)
01-01 12:25:12.625: E/Database(412): at android.view.View.performClick(View.java:2485)
01-01 12:25:12.625: E/Database(412): at android.view.View$PerformClick.run(View.java:9080)
01-01 12:25:12.625: E/Database(412): at android.os.Handler.handleCallback(Handler.java:587)
01-01 12:25:12.625: E/Database(412): at android.os.Handler.dispatchMessage(Handler.java:92)
01-01 12:25:12.625: E/Database(412): at android.os.Looper.loop(Looper.java:130)
01-01 12:25:12.625: E/Database(412): at android.app.ActivityThread.main(ActivityThread.java:3683)
01-01 12:25:12.625: E/Database(412): at java.lang.reflect.Method.invokeNative(Native Method)
01-01 12:25:12.625: E/Database(412): at java.lang.reflect.Method.invoke(Method.java:507)
01-01 12:25:12.625: E/Database(412): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
01-01 12:25:12.625: E/Database(412): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
01-01 12:25:12.625: E/Database(412): at dalvik.system.NativeStart.main(Native Method)
01-01 12:25:12.685: D/dalvikvm(412): GREF has increased to 201
你有一個失敗的約束。請顯示您的表格架構,以及您正在運行的實際查詢,並確保您不是簡單地插入重複密鑰。 – Mat 2012-01-01 10:31:21
你提到了類似的問題:http://stackoverflow.com/questions/8558850/unable-to-insert-data-into-sqlite-database-for-android-device。它可能有幫助 – Shraddha 2012-01-01 10:32:47