Help please

mauri74doc

Member
Licensed User
Longtime User
Hello everyone I am creating my first application in B4A and I noticed some differences with respect to visual basic'm used to.
my request is very simple, starting from the data read from my db

'Dim Cursor As dbcursor
'Dbcursor DBSql.ExecQuery = ("SELECT category FROM arguments")

my goal is to create a dynamic array that contains the data is not duplicated but I'm in trouble with the management of these arrays because I can no longer use ReDim Preserve to vb. Also, the syntax for my cycle loop (as written in vb) is incorrect.

What should I do?
thanks in advance
 

Dman

Active Member
Licensed User
Longtime User
Hello everyone I am creating my first application in B4A and I noticed some differences with respect to visual basic'm used to.
my request is very simple, starting from the data read from my db

'Dim dbCursor As Cursor
'Dbcursor DBSql.ExecQuery = ("SELECT category FROM arguments")

my goal is to create a dynamic array that contains the data is not duplicated but I'm in trouble with the management of these arrays because I can no longer use ReDim Preserve to vb. Also, the syntax for my cycle loop (as written in vb) is incorrect.

What should I do?
thanks in advance


If you want to put it into a spinner, you would use

B4X:
Dim dbCursor As Cursor
dbCursor = SQL1.ExecQuery("SELECT DISTINCT category FROM arguments")
 
   For i = 0 To Main.dbCursor.RowCount - 1
      DoEvents
      Main.dbCursor.Position = i
      spnCat.add(Main.dbCursor.GetString("category"))
   Next   
 
   dbCursor.Close
 
Upvote 0
Top