DBCursorMoveTo
- Last UpdatedAug 07, 2026
- 2 minute read
DBCursorMoveTo moves the cursor to the specified row in a SQL result set and then copies that row's values to the mapped tags. If the specified row doesn't exist โ that is, if it's outside the range of the result set โ then the function returns an error code and doesn't change the mapped tags.
|
Function |
Group |
Execution |
String Exp. |
Windows |
Windows Embedded |
IoT View |
Thin Clients |
Mobile Access |
|---|---|---|---|---|---|---|---|---|
|
DBCursorMoveTo |
Database/ERP |
Synchronous |
No |
Supported |
Supported |
Not supported |
Supported |
Supported |
Syntax
DBCursorMoveTo( numCur, numRow, "optStrErrorTag" )
numCur
The cursor handle for the result set, which was returned by DBCursorOpen or DBCursorOpenSQL.
numRow
The row of the result set to which the cursor will be moved.
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 0.
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.
You can use the Database Gateway (StADOSvr) to directly monitor database connections for leaks and errors. For more information, see Database Interface.
Examples
As used in a Math worksheet:
|
Tag Name |
Expression |
|---|---|
|
nErrorCode |
DBCursorMoveTo(nCursor, 4) // Moves the cursor to the fourth row of the result set and copies those values. |