-1

cmd = New SqlCommand(sql, myConnection)
reader = cmd.ExecuteReader()
While reader.Read()
For Columns = 0 To reader.FieldCount - 1
Category = reader.Item(Columns) 'READ COLUMN FROM DATABASE
cmbfld.Items.Add(Category)
ComboRow += 1
Next
End While

this code is populating the records instead of the field name.what can i do pls?

Votes + Comments
Add code tag.
2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by __avd
0

GetName() Method,

cmd = New SqlCommand(sql, myConnection)
reader = cmd.ExecuteReader()
Dim I as Integer
For I=0 To reader.FieldCount - 1
   cmbfld.Items.Add(reader.GetName(I))
Next
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.