Combobox Selection Issue
807580Apr 27 2010 — edited Apr 27 2010I have an application that populates combobox2 based off of the selection made in combobox1. When a selection in combobox1 is made, I call a function that connects to a database and gets a list of all compatible parts for the selection in combobox1 from the MySQL table. I read the result set into a vector. I then pass the vector to combobox2 and it displays the list. Everything works perfectly.
The columns in MySQL are: sku, manufacturer, speed, cores, fsb, cache, l1,l2, compatible. I am puling out everything but the sku and compatible, and adding them to each row of the vector.
The problem I have is that after the user picks the option they want and it is time to submit the form, I want to get the sku number associated with their selection. Unfortunately, I can't go back to the database, as the manufacturer, speed, cores, fsb, cache, l1 and l2 might match hundreds of records. (I am using the column called "compatible" to determine which records go with which combobox1 selections).
What I can not seem to grasp, is what data structure I need to use to store the sku and the manufacturer/speed/cores/fsb/cache/l1/l2 so that they can be related to one another inside the combobox. I don't want to display the sku to the user, as that is unnecessary information.
There is a way in VB.net to set a value for a selection in the combobox, so that what is selected and what is sent to the system can be different. I don't know if something like that exists in Java. I don't know if something like an ArrayList would be better.