I'm having trouble figuring out how to fill a dynamic array function and then print it on declaration.
Here is the function:
Public Function SQLConductGetFields(InCommand As Object) As String()
Dim ConnectionA As New MySqlConnection(My.Application.sqlconnect)
Dim command As New MySqlCommand()
ConnectionA.Open()
command.Connection = ConnectionA
Dim reader As MySqlDataReader
command.CommandText = InCommand
reader = command.ExecuteReader()
Dim count As Integer = 0
Dim Results(count) As String
While reader.Read()
Results(count) = reader(0)
count = count + 1
ReDim Results(0 To count)
End While
reader.Close()
ConnectionA.Close()
SQLConductGetFields = Results
End Function
End Class
This is how I am trying to access it:
For index = 0 To T.SQLConductGetFields("Select Amount From " & Store1 & "lower Where id=" & modt.ToString & ";").GetUpperBound(0)
MsgBox(T.SQLConductGetFields("Select Amount From " & Store1 & "lower Where id=" & modt.ToString & ";")(index) & " ")
Next