When I run this code my listbox is empty. What is the best way to get data from SQL and into a listbox? When the form is submitted I want to use the CustomreID value data to store into another table and thought using the index would be the best solution.
sSQL = "SELECT CustomerID, Company from Customers Order by Company ASC"
cmd = New SqlCommand(sSQL, moConn)
rs = cmd.ExecuteReader()
While rs.Read
lsbDestination.Items.Insert(CInt(rs("CustomerID")), rs("Company"))
End While
lsbDestination.DisplayMember = "Company"; lsbDestination.ValueMember = "CustomerID";