Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

DB Tools Insert Data VI

Owning Palette: Database VIs and Function

Installed With: Database Connectivity Toolkit

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

Details  

create table? creates a table if a table does not exist. LabVIEW creates the table with column names provided in the columns input. If the columns input is empty, LabVIEW names the columns Col0, Col1, and so on. LabVIEW 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 is the data you want to insert in the database. If data is a cluster, LabVIEW inserts each item in the cluster in the table corresponding to each element in the columns input. The order is determined by the cluster order of the cluster such that the 0th item in the cluster is inserted into the column name given in the 0th element of the columns input. If the columns input is empty, the 0th item of the cluster is inserted into the first column in table.If data is not a cluster, data is inserted into the column specified by the columns input.
connection reference specifies a reference to an ADO Connection object.
table is 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 VI or function runs. The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. This VI or function runs normally only if no error occurred before this VI or function runs. If an error occurs while this VI or function runs, it runs normally and sets its own error status in error out. Use the Simple Error Handler or General Error Handler VIs to display the description of the error code. Use exception control to treat what is normally an error as no error or to treat a warning as an error. Use error in and error out to check errors and to specify execution order by wiring error out from one node to error in of the next node.
status is TRUE (X) if an error occurred before this VI or function ran or FALSE (checkmark) to indicate a warning or that no error occurred before this VI or function ran. The default is FALSE.
code is the error or warning code. The default is 0. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.
source specifies the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning. The default is an empty string.
flatten cluster? if a cluster is wired to data and flatten cluster? is TRUE, the VI attempts to insert the cluster as a binary value instead of treating its items as individual columns. This implies that the column that this cluster is being inserted into is a binary column.
use file? instructs the VI to use a user-supplied 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. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces. Right-click the error out front panel indicator and select Explain Error from the shortcut menu for more information about the error.
status is TRUE (X) if an error occurred or FALSE (checkmark) to indicate a warning or that no error occurred.
code is the error or warning code. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.
source describes the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning.

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.


Resources


 

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