Can anyone help with this i am trying to populate a combobox with the returned values of an SQL statement from an access database the statement returns the values that i want but don't know how to pass the values into the combobox.

SQL statement
SELECT DISTINCT Stock_Name
FROM Stock
WHERE (Supplier_ID = ?)

i am using the return a datatable option on the vb sql statement builder not sure if this is the right way to return the data but thats why i am asking for help with this.

any help greatly appreciated

This is for a list box but is much the same

Dim connectionString As String = DBConnectionString
        Dim sqlConn As New SQLiteConnection(connectionString)
        Dim SQLComm As New SQLiteCommand("SELECT * FROM Collections", sqlConn)

        sqlConn.Open()

        Dim r As SQLiteDataReader = SQLComm.ExecuteReader()

        While r.Read()
            lbProjectType.Items.Add(New MyListboxItem(r("CollName"), r("CollGuid")))
        End While

        sqlConn.Close()

thanks for your response pointed me in the right direction

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.