iOS Question B4i IOS SQL Problem

WebQuest

Active Member
Licensed User
Longtime User
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:
Code: Copy
 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: Copy
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.
 
Upvote 0
Thank you for your quick answer. But yes 'Do while' what parameter do I insert? on b4a I got the total of the rows with C.RowCount!
B4X: Copy
Do While ?
'code...
loop
 
Upvote 0
Back
Top