I am using the attached code to grab a list of suppliers. With the code I have it loads the results horizontally into the left most cells, I would like these to go across the top of Row1 as column names. Is this possible? Im thinking I may have to load them into an array and then loop thru the array inserting into the grid?
Private Sub LoadSuppliers()
Dim LoadVendorconn As New SqlConnection("")
Dim LoadVendorstrSQL As String = "SELECT * FROM Suppliers ORDER BY Supplier"
Dim LoadVendorda As New SqlDataAdapter(LoadVendorstrSQL, LoadVendorconn)
Dim LoadVendordt1 As New DataTable
If you're using a FlexGrid, which your variable of "FlxRtv" leads me to believe, each row of values needs to be seperated by a tab character. With an unbound FlexGrid, you could do something like this (assume "rs" is the returned recordset from your Select query):
Dim txt As String
While Not rs.EOF
If Len(txt) Then
txt = txt & vbTab & rs.Supplier
Else
txt = rs.Supplier
End If
Wend
Dim txt As String
While Not rs.EOF
If Len(txt) Then
txt = txt & vbTab & rs.Supplier
Else
txt = rs.Supplier
End If
Wend
FlxRtv.AddItem txt