Hi guys I'm translating my app from B4a to B4i for IOS. In the documentation it is not specified whether a (cursor) should be used for queries as is the case on B4a. In fact, returning the code from B4a to B4i the Cursor method (dim C as Cursor) it is not possible to declare it. I guess he needs a library! I am using iSql but even with this library I cannot declare the cursor. Does anyone know how to do?
In B4a I have this code:
B4a Code:
Dim c As Cursor
c=s.ExecQuery("SELECT Name FROM Users")
If c.RowCount>0 Then
For i = 0 To c.RowCount - 1
c.Position = i
Var1=c.GetString("Name")
Next
Log("Nome:"&Var1)
c.Close
End If
Cursor does not exist in B4i nor in B4J.
You must use ResultSet instead.
B4X:
Private ResultSet1 As ResultSet
ResultSet1 = s.ExecQuery("SELECT Name FROM Users")
Do While
ResultSet1.NextRow
Var1 = ResultSet1.GetString("Name")
Loop
You may change the code also in B4A, because the code above works also in B4A and then you are cross-platform.