Example Code

Connect Directly to a Microsoft Access Database Using Connection String

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW Enterprise Connectivity Toolkit

Code and Documents

Attachment

Description

With the LabVIEW Enterprise Connectivity Toolkit, you can access many different types of databases using the appropriate Microsoft ActiveX Data Object (ADO)-compliant OLE-DB or ODBC driver.

One database is the Microsoft Access database. You can connect to an Access database using the Microsoft Jet OLEDB driver.

Usually you can set up the connection by creating a Universal Data Link (.udl) file and inputting the path to the DB Tools Open Connec VI in the LabVIEW Enterprise Connectivity Toolkit. However, you also can connect to a database directly without setting up a UDL file. This example demonstrates how to use connection strings to set the provider for the database. Because connection strings can be difficult to use and using a UDL file offers more control over the type of access to the database, using the UDL file is recommended.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.