I have the next combobox:
this.comboBoxProd.Enabled = false;
this.comboBoxProd.FormattingEnabled = true;
this.comboBoxProd.Items.AddRange(new object[] {
"Cameras",
"------------",
" Digital IXUS 850 IS ",
" Digital IXUS 900 Ti ",
" Digital IXUS 75 -NEW- ",
" Digital IXUS 70 -NEW- ", etc.
I want to change it and take the values from a db.
My database name is bd1.mdb and in the table Cameras it has the following fields: CamID, Cameras, Warranty, Year. I am only interested in the “Cameras” field.
Thank you!
You should take a closer look for ADO.NET operations with .mdb files here
First,prepare your connection string
Next step is to prepare your query
You will need an adapter to bind datasource,in your case it’s OleDbDataAdapter
Now you can use a DataTable object to bind into combobox
Fill data into your source
Your source is full with Cameras,now you can refer to your combobox control
DO NOT FORGET THAT you should that which field will be displayed in Combobox items