Android Question Displaying SQLQUERY OUTPUT under JRDC2 implementation in a B4XTable


Active Member
Licensed User
Longtime User

This is with regards to the JRDC2 implementation shown in the link

I would like to show the output of the SQL Query in a B4XTable.

In the '' file under JRDC I have named a Select statement as 'selectAllStoreData'. The database is MYSQL.

The key subroutine in b4A:

Sub getRecord()
Dim req As DBRequestManager = CreateRequest
Dim cmd As DBCommand = CreateCommand("selectAllStoreData", Null)
Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone(j As HttpJob)
If j.Success Then

'HERE I WANT TO DISPLAY THE OUTPUT IN A B4XTABLE .. How should I write the code ?
..... end if

end sub

My doubt:

1) What code should I write above in order to display the output in a Table ?

Please help.


B4X founder
Staff member
Licensed User
Longtime User
Please use [code]code here...[/code] tags when posting code.

It doesn't matter where the data comes from. You need to create the 'data' list which is a List of arrays of objects. Each array will be added as a single row.

req.HandleJobAsync(j, "req")
  Wait For (req) req_Result(res As DBResult)
 'work with result
 Table.SetData(req.Rows) 'this will work if the data is formatted exactly as you want it to be displayed.
 'another option which is relevant when you need to further process the data before it is displayed:
  Dim data As List
  For Each row() As Object In res.Rows
    Dim val1 As String = row(res.Columns.Get("animal"))
    Dim val2 As Int = row(res.Columns.Get("age"))
    data.Add(Array(val1, val2)
Upvote 0