0

Hello,

I have two linked tables in my database (access), one is for the student and one is the ages(selection drop list ).

When I have transfered the data in vb form, a simple text box is shown with numbers in it. How can I have the drop down list shown with the data I need instead of the numbers?

Thanks.

2
Contributors
1
Reply
3
Views
5 Years
Discussion Span
Last Post by Mitja Bonca
1

Use DataReader class and Add items to comboBox:

Dim connString As String = "Provider=Microsoft.ACE.OLEDB.12.0;data source=C:MyFolder\MyProject\myAccessDatabase.accdb"
Dim conn As New OleDbConnection(connString)
Dim sql As String = "SELECT ColumnName FROM Clientes"
Dim cmd As New OleDbCommand(sql, conn)
conn.Open()
Dim reader As OleDbDataReader = cmd.ExecuteReader()
While reader.Read()
    comboBox1.Items.Add(reader(0).ToString())
End While
reader.Close()
conn.Close()
cmd.Close()
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.