Last post Dec 20, 2005 03:58 PM by sbyard
Dec 20, 2005 09:57 AM|nixie|LINK
Hi there, I ve got a question.
Let's say I have an info object with information about a car.
One of the fields would be colorID with integer values representing colors from another table.
Lets say the colortable would then have an ID and a Name field.
Now if I would ask all the data for 300 cars, how can I prevent the module from connecting to the database 300 times to ask for the color. I would now use a function like this:
Dec 20, 2005 03:58 PM|sbyard|LINK
Two ways of dealing with this
If you want data in a dataset, create two linked tables. Use a data adapter to load the (dependant) colour table, then the cars. It looks similar to the database tables.
Create an enumeration that replicates the colour table (id and colo(u)r name). Set the object colour id to the one on the database. You can then print the string name as needed directly from the enumeration.