Home > LabVIEW > Access Different Access Database Files Programmatically in LabVIEW with Database Connectivity Toolset

Access Different Access Database Files Programmatically in LabVIEW with Database Connectivity Toolset

January 16th, 2009

One of my project needs to save test results to different Access database files for different units to be tested. The database files’ name is automatic generated based on UUT’s serial number. Currently, I’m using the LabVIEW Database Connectivity Toolset, and the default method to access a database file by it is UDL file. The UDL file contains only one static database file and it is quite hard to change it programmly without manually select a database file and click the confirm button.  And it will be a nightmare to create each UDL file for each UUT before the test is taken.

To change the UDL file’s content in LabVIEW programmly is not easy too. Because UDL file  is unicode-formatted, and LabVIEW is quite limited in support to unicode. I had tried several ways to change the database file name in UDL file and save the UDL file to hard disk. And when I open the changed UDL again, I got “File corrupted” message. It seemed that it is not a good way.At last, I had to read the help file of Database Connectivity Toolset word by word to find a way to work round. Wow, I found out that the VI DB Tools Open Connection is a Polymorphic VI that accepts string and file path data types. Just append the Access database file’s path after “Provider=Microsoft.Jet.OLEDB.4.0; Data Source=”, and wire it to connection information connector of DB Tools Open Connection VI, and everything will be OK.  Everything get solved.

It is really a good habit to read the help file carefully.

LabVIEW , , ,

  1. December 2nd, 2009 at 20:26 | #1

    Good info, thanks for sharing it. Is “Programmly” a real word ;-)

    Dennis

  2. January 28th, 2010 at 22:53 | #2

    @Access Database Programmer
    Ha, it should be “programmatically”, thanks!

  1. No trackbacks yet.