B4J Question jRDC2 get fields

Declan

Well-Known Member
Licensed User
Longtime User
I cannot understand what I am doing incorrectly.
I need to extract the individual fields from "req_Result(res As DBResult)"
My Code:
B4X:
Sub GetNotSent
   Dim req As DBRequestManager = CreateRequest
    Dim cmd As DBCommand = CreateCommand("select_notsent", Array())
   Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone(j As HttpJob)
   If j.Success Then
       req.HandleJobAsync(j, "req")
       Wait For (req) req_Result(res As DBResult)
       'work with result
        MyID = res.Columns.Get("id")
        MyCity = res.Columns.Get("city")
        MyProduct1 = res.Columns.Get("product1")

        req.PrintTable(res)
        Log("ID: " & MyID)
        Log("City: " & MyCity)
        Log("Product: " & MyProduct1)
   Else
       Log("ERROR: " & j.ErrorMessage)
   End If
    j.Release
End Sub

Return in Log:
B4X:
Waiting for debugger to connect...
Program started.
Tag: null, Columns: 3, Rows: 3
id    city    product1   
35    Centurion    Life Policy   
36    Centurion    Life Policy   
37    Centurion    Life Policy   
ID: 0
City: 1
Product: 2

The following worked in RDC:
B4X:
MyID = (Records(result.Columns.Get("id")))
MyCity = (Records(result.Columns.Get("city")))
MyProduct1 = (Records(result.Columns.Get("product1")))
 
Top