Connect to a Custom Database Using the LabWindows™/CVI™ SQL Toolkit

Updated May 4, 2023

Reported In

Software

  • LabWindows/CVI
  • LabWindows/CVI SQL Toolkit

Operating System

  • Windows

Issue Details

We want to make a custom database file. We are using the LabWindows/CVI SQL Toolkit. However, the data is automatically saved to the sample file of CVI SQL toolkit under the folder C:\......\CVI\Samples\sql, instead of to our target file. How can we fix this?

Solution

The first step is to register your database. You can copy and paste the default Samples MDB file into another location and renamed it:

 

Next, you need to register the database in the Microsoft ODBC manager. For this, in the Windows search, type in ODBC Data Source Administrator and open ODBC Data Sources (32-bit). Navigate to the System DSN tab.

 

 

Here, you'll see your registered Data Source Names (DSN). The CVI SQL Samples should look familiar because that's what CVI has been calling. To register your database, click on Add and select the Microsoft Access Driver (*.mdb) option:

 

 

Click Finish, and enter a Name and Description as shown below. The Data Source Name will be how you reference the database in your program.

 

Click Create and enter a name for your custom .mdb file. 

 

Click OK and now you should see your database appear under the System Data Sources:

Now connect to it from your code by replacing CVI SQL Samples with Custom DB. You can search sql in the Example Finder (Help >> Find Examples). 

 

Attachments