how to dimension a array by program

sultan87

Active Member
Licensed User
Longtime User
good evening
here an example

Curseur = SQL.ExecQuery("SELECT * FROM Relevés")

NumberOfColumns = curseur.ColumnCount
Dim ColumnName(NumberOfColumns) As String ' names of the columns

For i = 0 To curseur.ColumnCount - 1
ColumnName(i) =curseur.GetColumnName(i)
Next

I would like to put Dim ColumnName in Sub Global so that I can m' in being useful in d' other Sub

Best Regards
 

NeoTechni

Well-Known Member
Licensed User
Longtime User
Curseur = SQL.ExecQuery("SELECT * FROM Relevés")

Dim ColumnName as list ' names of the columns

For i = 0 To curseur.ColumnCount - 1
ColumnName.add(curseur.GetColumnName(i))
Next

ColumnName.size would be the number of columns
To get a column name from ColumnName, use ColumnName.get(i)

Lists are better in most ways than redimming an array.
 
Upvote 0
Top