Hello,
I have wrote a little test app, by clicking a button he asks the database, with a JRDC2 client. The result should be in a label. Here the code:
and this is the error:
line 75 is this line:
Now comes the funny, there are individual cases because the code works.
what am I doing wrong? Or can you solve it differently?
Thanks for answers.
Greetings!
I have wrote a little test app, by clicking a button he asks the database, with a JRDC2 client. The result should be in a label. Here the code:
B4X:
Sub btn_select_Click
Dim cmd As DBCommand
cmd.Initialize
cmd.Name = "select_too"
reqManager.ExecuteQuery(cmd, 0, Null) 'NULL
End Sub
Sub JobDone(Job As HttpJob)
If Job.Success = False Then
Log("Error: " & Job.ErrorMessage)
Else
If Job.JobName = "DBRequest" Then
reqManager.HandleJobAsync(Job, "ReqManager")
End If
End If
Job.Release
End Sub
Sub ReqManager_Result(result As DBResult)
reqManager.PrintTable(result)
Dim row() As String = result.Rows.Get(0)
lbl_text.Text = row(0) & row(1)
End Sub
and this is the error:
B4X:
Logger connected to: samsung SM-G935F
--------- beginning of crash
--------- beginning of main
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (httputils2service) Create **
** Service (httputils2service) Start **
Class not found: b4j.example.main$_dbresult, trying: com.database.main$_dbresult
Tag: null, Columns: 2, Rows: 1
column_1 column_2
Alexander Stolte
Error occurred on line: 75 (Main)
java.lang.ClassCastException: java.lang.Object[] cannot be cast to java.lang.String[]
at com.database.main._reqmanager_result(main.java:506)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at anywheresoftware.b4a.BA$2.run(BA.java:338)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6688)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
line 75 is this line:
B4X:
Dim row() As String = result.Rows.Get(0)
Now comes the funny, there are individual cases because the code works.
what am I doing wrong? Or can you solve it differently?
Thanks for answers.
Greetings!