I need help again please.
I have different Tables in a SQLite Database where I store my different Geometric Parameters of a Road Design. These will consist of Horizontal Alignment, Vertical Alignment, Crossfalls, Stakeline Offsets, etc.
When I open the Activity to display the Vertical Alignment, it will show all the Stakevalues of the Vertical Curves in a Combobox. This it all displays correctly, but when I click on one of the Stakevalues in the Combobox to show me the Stakevalue, VPI Elevation and the Parabolic curve lengths it gives me an error.
Here is the error message:
Error occurred on line: 1222 (AddGeo)
android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 0
at android.database.AbstractCursor.checkPosition(AbstractCursor.java:514)
at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:138)
at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:52)
at anywheresoftware.b4a.sql.SQL$CursorWrapper.GetString(SQL.java:377)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:146)
at anywheresoftware.b4a.BA$1.run(BA.java:352)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7731)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:612)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:997)
(Exception) java.lang.Exception: android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 0
This is the code that I am using:
I have different Tables in a SQLite Database where I store my different Geometric Parameters of a Road Design. These will consist of Horizontal Alignment, Vertical Alignment, Crossfalls, Stakeline Offsets, etc.
When I open the Activity to display the Vertical Alignment, it will show all the Stakevalues of the Vertical Curves in a Combobox. This it all displays correctly, but when I click on one of the Stakevalues in the Combobox to show me the Stakevalue, VPI Elevation and the Parabolic curve lengths it gives me an error.
Here is the error message:
Error occurred on line: 1222 (AddGeo)
android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 0
at android.database.AbstractCursor.checkPosition(AbstractCursor.java:514)
at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:138)
at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:52)
at anywheresoftware.b4a.sql.SQL$CursorWrapper.GetString(SQL.java:377)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:146)
at anywheresoftware.b4a.BA$1.run(BA.java:352)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7731)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:612)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:997)
(Exception) java.lang.Exception: android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 0
This is the code that I am using:
B4X:
[/
Sub Load_Ver
VerNo.clear
ResultSet = CGlobals.SQL1.ExecQuery("SELECT Stake FROM VerPi")
Do While ResultSet.NextRow
Try
'VerNo.Add(NumberFormat2(ResultSet.GetString("Stake"),1,3,3,False))
VerNo.Add(ResultSet.GetString("Stake"))
Catch
Log(LastException)
End Try
Loop
ResultSet.Close 'close
End Sub
Sub VerNo_ItemClick (Position As Int, Value As Object)
WorkItem = VerNo.SelectedItem
'WorkItem=NumberFormat2(WorkItem,1,3,3,False)
Try
Query = "SELECT * FROM VerPi WHERE Stake = ?"
ResultSet =CGlobals.SQL1.ExecQuery2(Query, Array As String (WorkItem))
ResultSet.NextRow
VerStake.Text = NumberFormat2(ResultSet.GetString("Stake"),1,3,3,False)
VPILevel.Text = NumberFormat2(ResultSet.GetString("VPiLevel"),1,3,3,False)
Length1.Text = NumberFormat2(ResultSet.GetString("Length1"),1,3,3,False)
Length2.Text = NumberFormat2(ResultSet.GetString("Length2"),1,3,3,False)
CurveType.SelectedIndex=ResultSet.GetString("CType")
Catch
Log(LastException)
CurveType.SelectedIndex=0
End Try
ResultSet.Close
End Sub
]
I can list the Vertical Alignment in a Table without any problems.