Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

DB Tools Insert Data VI

LabVIEW 2013 Database Connectivity Toolkit Help

Edition Date: June 2013

Part Number: 370016F-01

»View Product Info
Download Help (Windows Only)

Owning Palette: Database VIs and Function

Requires: Database Connectivity Toolkit

Inserts a new row into the table in the database identified by the connection reference.

Details  Examples

create table? creates a table if a table does not exist. This VI creates the table with column names provided in the columns input. If the columns input is empty, this VI names the columns Col0, Col1, and so on. This VI determines the type information of the columns created using the data input. If the data input is a cluster, each item in the cluster corresponds to a column that is created in the table.

Note   For string column types, the size is set equal to the size of the data.
data specifies the data you want to insert in the database. If data is a cluster, this VI inserts each item in the cluster to each element in the columns input. The item order of the cluster determines the order how this VI inserts the items to the table. For example, this VI inserts the 0th item to the 0th element of the columns input. If the columns input is empty, this VI inserts the 0th item of the cluster to the first column in table.

If data is not a cluster, this VI inserts the data to the column specified by the columns input.
connection reference specifies a reference to an ADO Connection object.
table specifies the name of the table in the database in which to insert data. If the create table? input is TRUE, the VI attempts to create the table if it does not already exist.
columns is the column in the table to insert data into. Wiring an empty array to this input assumes that all columns in the table are to be used.
error in describes error conditions that occur before this node runs. This input provides standard error in functionality.
flatten cluster? specifies whether to insert a cluster that you wire to data as a binary value. If the value is TRUE, this VI updates the column that you specify in the columns input with the flattened binary value of the cluster. If the value is FALSE, this VI updates each column that you specify in the columns input with the corresponding item in the cluster. The default is FALSE.
Note  This input is valid only if you wire a cluster to the data input.
use file? instructs the VI to use a user-supplied file to determine database types. If you set use file? to FALSE, this VI uses a user-specified file to determine database types. If you set use file? to TRUE, this VI uses the dbtypes.ini file, located in the labview\Database directory, to determine database types. This VI uses use file? only when create table? is TRUE.
connection reference out returns a reference to an ADO Connection object.
error out contains error information. This output provides standard error out functionality.

DB Tools Insert Data Details

The insert is performed on the columns in the columns array, or if the columns array is empty, all columns in table are used. The data input can either be a single element or a cluster with each cluster element corresponding to a column in the table. The order of the elements in the cluster determines which column each element is inserted into. Thus, the number of items in the cluster must equal the number of elements in the columns array, or if the columns array is empty, the number of items in the cluster must equal the number of columns in the table. In the case where data is a single element, the columns array must have one element, or there must be one column in the table.

Examples

Refer to the following VIs for examples of using the DB Tools Insert Data VI:

  • Create DatabaseTable VI: labview\examples\database
  • Database Insert VI: labview\examples\database
  • Database Logging VI: labview\examples\database
  • Sixtypes Insert VI: labview\examples\database

 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit