DBUpdate
- Last UpdatedAug 07, 2026
- 2 minute read
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 |
String Exp. |
Windows |
Windows Embedded |
IoT View |
Thin Clients |
Mobile Access |
|---|---|---|---|---|---|---|---|---|
|
DBUpdate |
Database/ERP |
Synchronous |
No |
Supported |
Supported |
Not supported |
Supported |
Supported |
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. For more information, see Database/ERP worksheet.
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 parameter is optional. If no rows are specified, all rows of the table will be selected.
optStrErrorTag
The name of a project tag that will receive detailed error messages, if errors occur during project run time.
Note: If this parameter is enclosed in quotes, the string literal will be used. Otherwise, the value of the tag/expression will be used.
This parameter is optional.
Return value
In the case of success, this function returns the number of rows that were updated.
In the case of error, this function returns one of the following possible values:
|
Value |
Error Message |
|---|---|
|
-1 |
|
|
-2 |
|
|
-3 |
|
|
-4 |
|
|
-5 |
|
|
-6 |
|
|
-7 |
|
|
-8 |
|
|
-9 |
|
|
-10 |
|
|
-100 |
|
|
-101 |
|
|
-102 |
|
|
-103 |
|
|
-104 |
|
|
-105 |
|
|
-106 |
|
|
-107 |
|
|
-108 |
|
|
-109 |
|
|
-110 |
|
|
-111 |
|
|
-112 |
|
|
-113 |
|
|
-114 |
|
|
-115 |
|
|
-199 |
|
|
-200 |
|
|
-201 |
|
|
-202 |
|
Notes
Database/ERP functions emulate Structured Query Language (SQL) database operations. Before you use these functions, familiarize yourself with how SQL statements are formed and executed.
This function recognizes only 16000 rows of a table at one time. If a selected section of table has more than 16000 rows, only the first 16000 rows of the selection will be accessible to any built-in language Database/ERP functions. Exceeding this limit may return an EOF error even if the end of the file has not been reached.
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. |