Salve, sto scrivendo un programma per basic4android che gestisce un database;
nell'insert ho incontrato un errore di compilazione a cui non trovo soluzione, qui il codice e l'errore.
69 Sub Button1_Click
70 sql1.ExecNonQuery("INSERT INTO table1 VALUES('id', 'cognome', 'nome')")
71 sql1.ExecNonQuery2("INSERT INTO table1 VALUES(NULL,?, ?)", Array As
Object(EditText2.Text,EditText3.Text))
72 End Sub
Errore:
Error occurred on line: 70 (main)
android.database.sqlite.SQLiteConstraintException: error code 19: constraint failed
at android.database.sqlite.SQLiteStatement.native_execute(Native Method)
at android.database.sqlite.SQLiteStatement.executeUpdateDelete(SQLiteStatement.java:92)
at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1899)
at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1839)
at anywheresoftware.b4a.sql.SQL.ExecNonQuery(SQL.java:67)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:680)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:308)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:238)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:121)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:77)
at android.view.View.performClick(View.java:3511)
at android.view.View$PerformClick.run(View.java:14109)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
nell'insert ho incontrato un errore di compilazione a cui non trovo soluzione, qui il codice e l'errore.
69 Sub Button1_Click
70 sql1.ExecNonQuery("INSERT INTO table1 VALUES('id', 'cognome', 'nome')")
71 sql1.ExecNonQuery2("INSERT INTO table1 VALUES(NULL,?, ?)", Array As
Object(EditText2.Text,EditText3.Text))
72 End Sub
Errore:
Error occurred on line: 70 (main)
android.database.sqlite.SQLiteConstraintException: error code 19: constraint failed
at android.database.sqlite.SQLiteStatement.native_execute(Native Method)
at android.database.sqlite.SQLiteStatement.executeUpdateDelete(SQLiteStatement.java:92)
at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1899)
at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1839)
at anywheresoftware.b4a.sql.SQL.ExecNonQuery(SQL.java:67)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:680)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:308)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:238)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:121)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:77)
at android.view.View.performClick(View.java:3511)
at android.view.View$PerformClick.run(View.java:14109)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)