I'm in the process of converting text records to an SQL db but have hit a snag.
The db appears to be populated correctly and various queries and non queries work as expected. Just prior to this code snippet the db was queried and all data from 1 table was displayed in a CustomListView as expected.... Cursor1 was Closed.
A List LongClick fires the following ..
The error ,Cursor Index out of bounds : Index 1 Requested with a size of 1.
The table has 13 fields (TEXT) Col1 being P_id of PRIMARY INTEGER KEY
All 3 queries cause the error. for the exercise P_id 5 Col2 is Baked Beans.
What am I missing ...
Cheers mj
The db appears to be populated correctly and various queries and non queries work as expected. Just prior to this code snippet the db was queried and all data from 1 table was displayed in a CustomListView as expected.... Cursor1 was Closed.
A List LongClick fires the following ..
B4X:
Sub btnDeleteItem_Click
Dim rowID As Int
Dim recData(2) As String
rowID = 5
'Cursor1 = SQL1.ExecQuery("SELECT Col2, Col3 FROM Records WHERE P_id = '" & rowID & "' ")
Cursor1 = SQL1.ExecQuery("SELECT Col2, Col3 FROM Records WHERE P_id = 5 ")
'Cursor1 = SQL1.ExecQuery("SELECT Col2, Col3 FROM Records WHERE Col2 = 'Baked Beans' ")
'Cursor1.Position = 5
recData(0) = Cursor1.GetString("Col2") 'ERROR OCCURS HERE *****
recData(1) = Cursor1.GetString("Col3")
The error ,Cursor Index out of bounds : Index 1 Requested with a size of 1.
The table has 13 fields (TEXT) Col1 being P_id of PRIMARY INTEGER KEY
All 3 queries cause the error. for the exercise P_id 5 Col2 is Baked Beans.
What am I missing ...
Cheers mj