Selects a set of rows and columns in a database table, initializes the cursor at the first row of the result set, copies that row's values to mapped tags, and then returns a cursor handle that can be referenced by other DB/ERP functions.
Function | Group | Execution | Windows | Embedded | Thin Client |
---|---|---|---|---|---|
DBCursorOpen | Database/ERP | Synchronous | Supported | Supported | Supported |
DBCursorOpen( strDBConn, strTable, optStrCondition, optStrColumns, optStrTags, optStrOrder, "optStrErrorTag" )
This is an optional parameter. If no rows are specified, then all rows of the table will be selected.
This is an optional parameter. If no columns are specified, then all columns of the table will be selected.
This is an optional parameter. If no tags are specified, then no values will be copied.
This is an optional parameter. If no order is specified, then the rows will be left in the default order of the table.
This is an optional parameter.
Returns a numeric value that represents the cursor handle. In case of error, returns a negative number.
This function is equivalent to a SQL SELECT statement, except that it breaks the clauses of the statement into separate function parameters. If you know SQL and want to construct your own SELECT statement from scratch, you may use DBCursorOpenSQL instead.
See also DBCursorClose.
Tag Name | Expression |
---|---|
nCursor | DBCursorOpen( "DB1", "Table1", "Column1 > 3", "Column1, Column2", "Tag1, Tag2", "Column1, Column2 DESC", "TagError" ) // Opens Table1 of DB1 and selects all rows where Column1 has a value greater than 3. Column1 is mapped to Tag1, and Column2 is mapped to Tag2. Rows are ordered first by Column1, then by Column2, in descending order. Error messages are written to TagError. |