load sql qry result to a list

Smee

Well-Known Member
Licensed User
Longtime User
I am trying to add the results of a query to a list is there a similar way to this
B4X:
List1 = StringUtils.LoadCSV2(Dir, Filename, ",",  headers)
 

Smee

Well-Known Member
Licensed User
Longtime User
Thanks Erel. I tried that but i get an error

Compiling code. Error
Error compiling program.
Error description: Cannot cast type: {Type=Double,Rank=0} to: {Type=String,Rank=1}
Occurred on line: 157
ExecuteListView(Qry,"",0,List1,False)
Word:

This is the code

B4X:
   Dim h() As String
   Dim List1 As List
   Dim Qty As Int


   Qry="SELECT Orders.ProdCode,Products.Description,Orders.Qty FROM Orders " _
      & "LEFT OUTER JOIN Products ON Orders.ProdCode=Products.ProdCode"

ExecuteListView(Main.SQL,Qry,"",0,List1,False)
   
   
   Dim h(Cursor.ColumnCount) As String
      h(0) = "Prod Code"
      h(1) = "Description"
      h(2) = "Qty"
   
   grd.Cols = h.Length
   grd.Rows=0

   SetHeader(grd,h)
   For i = 0 To List1.Size - 1
      Dim row() As String
      row = List1.Get(i)
      AddRow(grd,row)
   Next
 
Upvote 0
Top