Retrieving from database based on choice made....

gdubbs

Member
Joined
Oct 26, 2004
Messages
11
Location
USA
Programming Experience
Beginner
Ok, here is my problem. I have a form with 4 comboboxes. the comboboxed are filled with items in 4 categories from a database. What I need to to is that when a user makes a selection from the combobox(the item's selectedindex.changed), I want it to go back to the database and pull the price for the item. The items have an item ID as well, and I am thinking that I need to load this value into the comboboxes as well (thoughnot make it visible) I am doing the DB by code, not by wizard.

Any ideas?
 
Try changing your dataset to a datatable and remove table1 from display/value member:

cboBeverage.DisplayMember = "name"
cboBeverage.ValueMember = "price"
 
It took me longer to code, but what I ended up doing is to make array's where values for the price could be placed. That way, the comboboxes selectedindex value is that same as the price in the array (0, 1, 2, 3, 4...etc)
 
Back
Top