使用您的建议和帮助,我设法将其转换为数据表并获得了预期的结果。谢谢你让我走上正轨。
这是我的最终结果。可能可以用更整洁的代码实现相同的结果,但这对我有用。再次感谢。
MySQLConn.Open()
Dim ColumnQry As New MySqlCommand("SELECT * FROM Stores WHERE 1=2", MySQLConn)
ColumnQry.CommandType = CommandType.Text
Dim da1 As New MySqlDataAdapter(ColumnQry)
dasColumns.Tables.Clear()
da1.Fill(dasColumns, "Columns")
Dim dt1 As DataTable = dasColumns.Tables("Columns")
For Each f As DataColumn In dt1.Columns
trvFilter.Nodes.Add(f.ColumnName, f.ColumnName)
Dim ValuesQry As New MySqlCommand("SELECT DISTINCT " & f.ColumnName & " FROM Stores ORDER BY " & f.ColumnName, MySQLConn)
ValuesQry.CommandType = CommandType.Text
Dim da2 As New MySqlDataAdapter(ValuesQry)
dasValues.Tables.Clear()
da2.Fill(dasValues, "Values")
Dim dt2 As DataTable = dasValues.Tables("Values")
For x = 0 To (dasValues.Tables("Values").Rows.Count - 1)
trvFilter.Nodes(f.ColumnName).Nodes.Add(dt2.Rows(x)(f.ColumnName).ToString)
Next
Next
MySQLConn.Close()