I'm transferring a application from vba to vb.net, This selects data from a SQL database and sends updates back.
My application has around 20 combo-boxes.
In VBA I used multi column combo-boxes with the RecordID from the database in a hidden column so when the user saved I only had to get the value out of the hidden column of the selected row and send the update to the database.
What is the best way to accomplish this in vb.net?
From what I can see you can only have one column in a combobox?
What sort of Data am I talking about?
Product Groups (Multiple groups)
Product pack sizes
Customer Groups (Multiple groups)
Do i load them all into Instances of their classes and fill the combo-boxes from the classes?
Then when I need to update the database can I retrieve the RecordID from the Class?
For Example with Staff
Create a Class with RecordID, Name, Phone, Position
1. On starting the Application create and instance of the class (Called "AllStaffRecords") that selects all the records from the SQL database.
2. Fill the Combo-box with the Names (From the "AllStaffRecords" Instance)
3. When the User needs to Search for a Name it will search the "AllStaffRecords" Instance of the class
4. When saving I lookup the "AllStaffRecords" instance to get the RecordID to update the database.
Is this a totally wrong approach?
Or should I be?
1. populating the Combo-box with a call to the Database
2. Calling the database each time the user needs to search for a staff name
3. call to the database to retrieve the RecordID before updating
The Second option would seem to have at a bare minimum 20 needless calls to the database for each record that is saved
What is the Best/Fastest way to accomplish this?