DBUpdate

Selects a result set and then writes the same value to all rows of a specified column. (This function is equivalent to a SQL UPDATE statement.)

Function Group Execution Windows Embedded Thin Client
DBUpdate Database/ERP Synchronous Supported Supported Supported
Note: This feature emulates SQL (Structured Query Language) database operations. You should be familiar with how SQL commands are formed and executed before you use this feature.

Syntax

DBUpdate( strDBConn, strTable, strValues, strColumns, optStrCondition, "optStrErrorTag" )
strDBConn
The name of the database connection. Connections are configured in the Database/ERP folder in the Project Explorer.
strTable
The name of the table in the database.
strValues
A string that lists the values to be written to the columns. This list of values should be comma-delimited, and string values must be enclosed in single quotes.
strColumns
A string that lists the columns into which the values will be written. This list of column names should be comma-delimited and in the same order as the values specified by strValues.
optStrCondition
A string that specifies which rows of the table to select. This is equivalent to the SQL WHERE clause, and the string should follow the same syntax.

This is an optional parameter. If no rows are specified, then all rows of the table will be selected.

optStrErrorTag
The name of a String tag that will receive detailed error messages, if errors occur during runtime.
Note: The tag name must be enclosed in quotes, as shown in the syntax diagram, or else the project will try to get the value of the named tag.

This is an optional parameter.

Returned value

Returns the number of rows updated. In case of error, returns a negative number.

Examples

As used in a Math worksheet:
Tag Name Expression
Tag DBUpdate( "DB1", "Table1", "'X'", "Column2", "Column1 = 1", "TagError" ) // In Table1 of DB1, for all rows where Column1 equals 1, writes "X" to Column2.
Что такое кассетные рулонные шторы.