Connection between LabVIEW and database (write)

Source: Internet
Author: User
Referring to the master LabVIEW virtual instrument Program Design (Zheng Yuanyuan) and a n I technical document, in-depth introduction to LabVIEW database application, objective: to learn the connection instance between LabVIEW and database: lab personnel registration system prior knowledge: the LabVIEW database Toolkit can only operate but cannot create databases. Therefore, you must use third-party Database Management

Referring to the "proficient in LabVIEW virtual instrument programming" (Zheng Yuanyuan) and a n I Technical Document "in-depth introduction to LabVIEW database application: learning LabVIEW database connection example: lab personnel registration system prior knowledge: LabVIEW database Toolkit can only operate but cannot create a database, so you must use third-party Database Management

For more information, see "proficient in LabVIEW virtual instrument Program Design" (Zheng Yuanyuan) and a n I Technical Document "in-depth introduction to LabVIEW database application".

Objective: To learn the connection between LabVIEW and databases
Example: laboratory personnel Registration System
Prior Knowledge: the LabVIEW database Toolkit can only operate but cannot create databases. Therefore, you must use a third-party database management system, such as Access, to create databases.
Software: LabVIEW8.5 (only ADO Database Toolkit is included, and version matching Toolkit for LabVIEW Database Connectivity is not found)
Microsoft Access 2007 [Access must use version 2003 (*. mdb) for saving file types. Later versions are not recognized]

Step:
1. Create a database.Open Access --> Create an empty Database Register. mdb[Be sure to save it as. mdb suffix format]

Create --- table design --- write field name and select data type --- save as Registration Form


2. Create a Data Source DSN (Data Source Names)In "Windows Control Panel", double-click "Administrative Tools", and then double-click "Data Source" to enter the ODBC data source Manager.

The data source name created under the user DSN (User Data Source Name) tab can only be accessed by this user, and the system DSN (system data source name) the data source name created under the tab is accessible to all users in the system. On the user DSN tab, click Add. The data source Driver selection dialog box is displayed, and then selectMicrosoft Access Driver (*. mdb)

Enter a name for the data source name in the pop-up ODBC Microsoft Access installation window, such RegisterData, And then click the select button in the database column to select the previously created Register. mdbDatabase file. Keep other parameters by default. Click OK.

After completing the preceding settings, you can view the new DSN on the user DSN tab.


Click OK to complete DNS creation.
3. Use UDL to connect to the database(Because the Toolkit of LabVIEW Database Connectivity that matches Version 8.5 is not found and no related functions can be called, you cannot directly connect to the Database using DNS. This connection also has other advantages, personal Understanding is not profound) in Register. create a text file in the mdb folder and rename it RegisterData. udl: Double-click this file to open the Data Link Properties dialog box.
Under the Provider tab, select Microsoft Jet 4.0 ole db Provider. On the connection tab, select the created database file and click test connection.
If the suffix of version 2007. accdb is in the form of or in the data source Driver selection dialog box, and then select Microsoft Access Driver (*. mdb, * accdb), the following error will occur:

4. Programming TestThe rear panel programming is as follows:

Layout the front panel and enter relevant data for execution (Database Name:Register. mdb)


Run the following command:


Database (refresh ):

Test successful!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.