Good point, Ben. I forgot you can't have nested types, so that would make it much simpler than the OpenG VI.
Basically, I believe that what you've posted is enough (although I don't think I would have a seperate query for each type. Instead, I would add the supported types into the query and ignore the unsupported types, or define them as binary). I still have a problem with the coupling you create with the DB structure, but I can see how people would want to automate this as much as possible. To get around that, maybe we can use a table name as part of the caption to allow selecting from different tables or maybe create a transalation table in the DB which will allow us to have constant names. I will play with this concept a little and see if I can come up with something useful.
BTW, I don't know if we can wire the variant directly into the Value property, because DB variants seem to be slightly different from LV variants. For example, if you attempt to convert an empty DB variant to an LV datatype, you will NOT get the default value if you use the standard Variant to Data function (at least in 7.0). This might not be an issue if we know that there will always be data there.
Another option - maybe convert from DB variant to variant and then use the property?
DB for LabVIEW is a new Toolkit Compatible with LabVIEW that does exactly what you want.
It uses the LV Database and Connectivity Toolkit to connect your existing database, automatically get the database structure and columns data types. Then, with this information, it automatically generates a LabVIEW VI for your database, and this VI will returns your database records in clusters instead of variants.
There is also many other advantages using this DB for LabVIEW since it automatically gives you access into one VI, to all queries, all tables, and populates columns names for you.
You can try this toolkit by downloading it on http://studiobods.com/en/produits.html
It will also be available on the LabVIEW Tools Network in few days.
Matthias Baudot | Software Architect | Founder at STUDIO BODs