Matrix1000
asked on
How to fill listbox from SQL query
I'm writing a small VB.NET app.
How would I fill a list box using an SQL query?
I have a listbox that I need to populate with data from SQL.
I have a username/password/SQL address. SQL query would be (select StockNumber from dbo.VehicleMaster)
Would appreciate a code sample :)
Thanks!
How would I fill a list box using an SQL query?
I have a listbox that I need to populate with data from SQL.
I have a username/password/SQL address. SQL query would be (select StockNumber from dbo.VehicleMaster)
Would appreciate a code sample :)
Thanks!
Is your database SQL server or something else?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
BriCrowe ,
Nice hijack.
Nice hijack.
ASKER
BriCrowe's example worked perfectly right off the bat.
Chaosian, VB.net had issues with
lstStocknumberList.DataSou rce = myTable
lstStocknumberList.DataTex tField = StockNumber
lstStocknumberList.DataVal ueField = StockNumber
lstStocknumberList.DataBin d()
saying that 'DataTextField' etc is not a member of System.Windows.forms.Listb ox.
Thanks for trying tho :)
Chaosian, VB.net had issues with
lstStocknumberList.DataSou
lstStocknumberList.DataTex
lstStocknumberList.DataVal
lstStocknumberList.DataBin
saying that 'DataTextField' etc is not a member of System.Windows.forms.Listb
Thanks for trying tho :)