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?

kvprajapati commented: Add code tag. -2

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
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.