hello
I have a problem with a sql query and precisely with the union all.
The query as written works perfectly, I also tested the program Db sql lite Browser, but when you run basic4android tells me that there is an error that a database column does not exist.
This is the error:
Error occurred on line: 529 (frmfinale)
java.lang.IllegalArgumentException: column 'idtipofase' does not exist
at android.database.AbstractCursor.getColumnIndexOrThrow(AbstractCursor.java:303)
at anywheresoftware.b4a.sql.SQL$CursorWrapper.GetString(SQL.java:355)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:636)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:302)
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:525)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:121)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:163)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:159)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:66)
at android.view.View.performClick(View.java:4475)
at android.view.View$PerformClick.run(View.java:18786)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5419)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
at dalvik.system.NativeStart.main(Native Method)
but I can confirm that the vb syntax is well written.
this is my vb code:
Dim cursore As Cursor
cursore = sqldb.ExecQuery("SELECT fase_finale.id,fase_finale.idevento,fase_finale.idtorneo,fase_finale.idsquadra,fase_finale.idtipofase,fase_finale.nrbicchieri,squadre.nome FROM fase_finale JOIN squadre ON fase_finale.idsquadra=squadre.id WHERE idtorneo="& frmtorneo.idtorneo &" AND idevento="& frmtorneo.idevento & _
" UNION ALL Select classifica_fase_gironi.id,classifica_fase_gironi.idevento,classifica_fase_gironi.idtorneo,classifica_fase_gironi.idsquadra,classifica_fase_gironi.idtipofase,classifica_fase_gironi.nrbicchieri,squadre.nome FROM classifica_fase_gironi JOIN squadre ON classifica_fase_gironi.idsquadra=squadre.id WHERE idtorneo="& frmtorneo.idtorneo &" AND idevento="& frmtorneo.idevento &" ORDER BY idtipofase DESC, fase_finale.nrbicchieri DESC")
For i = 0 To cursore.RowCount - 1
cursore.Position = i
If cursore.GetInt("fase_finale.idtipofase")=3 Then
.............
End If
If cursore.GetInt("fase_finale.idtipofase")=2 Then 'semifinali
..............
End If
Next
cursore.Close
help me please
I have a problem with a sql query and precisely with the union all.
The query as written works perfectly, I also tested the program Db sql lite Browser, but when you run basic4android tells me that there is an error that a database column does not exist.
This is the error:
Error occurred on line: 529 (frmfinale)
java.lang.IllegalArgumentException: column 'idtipofase' does not exist
at android.database.AbstractCursor.getColumnIndexOrThrow(AbstractCursor.java:303)
at anywheresoftware.b4a.sql.SQL$CursorWrapper.GetString(SQL.java:355)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:636)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:302)
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:525)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:121)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:163)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:159)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:66)
at android.view.View.performClick(View.java:4475)
at android.view.View$PerformClick.run(View.java:18786)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5419)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
at dalvik.system.NativeStart.main(Native Method)
but I can confirm that the vb syntax is well written.
this is my vb code:
Dim cursore As Cursor
cursore = sqldb.ExecQuery("SELECT fase_finale.id,fase_finale.idevento,fase_finale.idtorneo,fase_finale.idsquadra,fase_finale.idtipofase,fase_finale.nrbicchieri,squadre.nome FROM fase_finale JOIN squadre ON fase_finale.idsquadra=squadre.id WHERE idtorneo="& frmtorneo.idtorneo &" AND idevento="& frmtorneo.idevento & _
" UNION ALL Select classifica_fase_gironi.id,classifica_fase_gironi.idevento,classifica_fase_gironi.idtorneo,classifica_fase_gironi.idsquadra,classifica_fase_gironi.idtipofase,classifica_fase_gironi.nrbicchieri,squadre.nome FROM classifica_fase_gironi JOIN squadre ON classifica_fase_gironi.idsquadra=squadre.id WHERE idtorneo="& frmtorneo.idtorneo &" AND idevento="& frmtorneo.idevento &" ORDER BY idtipofase DESC, fase_finale.nrbicchieri DESC")
For i = 0 To cursore.RowCount - 1
cursore.Position = i
If cursore.GetInt("fase_finale.idtipofase")=3 Then
.............
End If
If cursore.GetInt("fase_finale.idtipofase")=2 Then 'semifinali
..............
End If
Next
cursore.Close
help me please