hi all,
Iam new to
VB iam trying to populate the combo box with the table item from SQL database(ODBC).
My code returns nothing into combo box.
when i debug ,the combo box shows nothing
here is my code
Dim Cmd As Odbc.OdbcCommand
Dim Con As Odbc.OdbcConnection
Dim Sql As String = Nothing
Dim Reader As Odbc.OdbcDataReader
Dim ComboRow As Integer = -1
Dim Columns As Integer = 0
Dim Category As String = Nothing
Dim Cmbbox As ComboBox
CmbboxMan.Items.Clear()
Con = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OleD b.4.0;data source=" & Database & "")
Sql = "SELECT [Comp_ItemNumber] FROM [Components] ORDER BY [Comp_ItemNumber] Asc"
Cmd = New Odbc.OdbcCommand(Sql, Con)
Con.Open()
Reader = Cmd.ExecuteReader()
While Reader.Read()
For Columns = 0 To Reader.FieldCount - 1
Category = Reader.Item(Columns) 'READ COLUMN FROM DATABASE
Next
Cmbbox.Items.Add(Category)
ComboRow += 1
End While
Con.Close()
URGENT reply me ASAP