iOS Question B4I Cursor

Sergio Haurat

Active Member
Licensed User
Longtime User
This function on Android works without problems, on iOS it shows an error. It just makes a query to a table and fills a map with the result.
I tried to simulate with DBUtils but it only returns the first record

Code:
Public Sub get_federations_map(strOrderField As String) As Map
    Dim mapTemp As Map
    mapTemp.Initialize
    Dim sqlSelect As SQL
    Dim sqlCursor As Cursor
    sqlSelect.Initialize(xui.DefaultFolder, "strings.db", False)
    sqlCursor = sqlSelect.ExecQuery("SELECT _id, " & strOrderField & " FROM cmn_lst_federaciones WHERE _id >= 4 ORDER BY " & strOrderField)
    For iCnt = 0 To sqlCursor.RowCount - 1
        sqlCursor.Position = iCnt
        mapTemp.Put(sqlCursor.GetInt("_id"), sqlCursor.GetString(strOrderField))
    Next
    sqlSelect.Close
    Return mapTemp   
End Sub

B4A IDE


B4I IDE
 
Solution
B4X:
Dim MainRS As ResultSet = B4XPages.MainPage.SQL.ExecQuery2(....)
Do While MainRS.NextRow

    Dim ITEM_ID As String = MainRS.GetString("ITEM_ID")
    NExt
    MainRS.close

jahswant

Well-Known Member
Licensed User
Longtime User
B4X:
Dim MainRS As ResultSet = B4XPages.MainPage.SQL.ExecQuery2(....)
Do While MainRS.NextRow

    Dim ITEM_ID As String = MainRS.GetString("ITEM_ID")
    NExt
    MainRS.close
 
Upvote 0
Solution

hatzisn

Expert
Licensed User
Longtime User

As @jahswant said in the answer but not stressed out, "ResultSet", can be used in all B4X IDEs except obviously B4R.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…