Ce contenu n’est pas disponible dans votre langue préférée.

Le contenu est disponible dans une autre langue. Votre navigateur peut inclure des fonctionnalités qui vous aideront à traduire le texte.

Executing Advanced SQL Statements With Database Connectivity Toolkit

Updated Jan 12, 2023

Reported In

Software

  • LabVIEW Database Connectivity Toolkit

Issue Details

With the Database Connectivity Toolset I can create a table, insert data, and select data from a table. How can I execute advanced SQL statements with the database connectivity toolset?

Solution

Advanced statements such as update, which changes data, and delete can be executed inside of LabVIEW by sending SQL statements to the database. This can be accomplished by using the DB Tools Execute Query VI which can be found in the Functions»Database»Advanced palettes of the Functions Pallette. This VI will allow the user to execute any SQL statement including the delete and update statements.

Additional Information

The Database Connectivity Toolset makes it easy to access a database by executing many of the SQL commands for you without requiring you to know SQL. 

For example, you can easily select data from a database by using the SELECT command. By either entering SELECT column_name(s) FROM table_name or Select * FROM TestTable  you can select data from a database.  This returns a cluster of two references. One of the references returned is the ADODB._Recordset. After you filter out the recordset fields with a Fields Property Node,  use a Fields Invoke node to get references to the items stored in the Fields of your databases.

For instance, the information you could be searching for might be the names of column headers for the SQL Database. If that were the case, you could index through the fields retrieving all of the Field references and then get the name of each reference. For more information about how to use this particular advanced SQL statement with labVIEW, follow the Community Example: Get Column Headers from SQL Query with Database Connectivity Toolkit  .

 


Visit the w3schools.com or Sqlcourse.com for additional information on SQL.