OpenResultset
This function will execute a pass-through SQL statement on the host through the connection maintained by the server. Any results from the statement will be returned in a RDO Resultset object. (Note: this item defaults to a static view of the database and cannot be updated. Also, under the configuration of the database, the ‘Connect Using…’ setting must match the declaration of the recordset; ADO versus RDO.)
Group: Database Related Extensions
Syntax:
oRs = DB.OpenResultset(sSQL, [vCursorType], [vLockType])
oRs (rdoResultset Object or adoRecordset Object) is a snapshot type resultset generated from an SQL statement.
sSQL (String) is the SQL statement to be sent to the database. This is a pass through statement; its syntax must be understood by the database, as no pre-processing will occur.
vCursorType (Variant) Optional – indicates the type of cursor used by the recordset object.
vLockType (Variant) Optional – indicates the type of lock placed on records during editing.
ADO Cursor Types
0 Provides a static copy of the records (you can't see additions, changes or deletions by other users). You can only move forward through the recordset. Forward-only is the ADO default cursor type.
1 Existing records at time of creation are updateable. You can't see additions or deletions. All types of movement are enabled.
2 Dynamic requires more overhead, because updates are immediate and all types of movement are enabled. The dynamic cursor isn't currently supported by the Microsoft Jet OLE DB Provider, and therefore defaults to a keyset cursor when adOpenDynamic is applied to a Jet database.
3 Provides a static copy of the records (you can't see additions, changes or deletions by other users), but all types of movement are enabled.
ADO Lock Types
1 This value indicates read-only records where the data cannot be altered.
2 This value indicates pessimistic locking, record by record. The provider does what is necessary to ensure successful editing of the records, usually by locking records at the data source immediately after editing.
This lock type is supported by the Microsoft® OLE DB Provider for AS/400 and VSAM and the Microsoft OLE DB Provider for DB2. However, the OLE DB Provider for AS/400 and VSAM internally maps this lock type to adLockBatchOptimistic.
3 This value indicates optimistic locking, record by record. The provider uses optimistic locking, locking records only when the Update method is called.
This lock type is not supported by the OLE DB Provider for DB2.
4 This value indicates optimistic batch updates and is required for batch update mode.
This option is not supported by the OLE DB Provider for DB2.
Example:
Using rdoResultset, the RDO language extensions must be enabled.
Dim oRs As rdoResultset
Dim sSQL As String
Dim sDesc As Variant
sSQL = "select * from ItemMaster where PartNo = '100620'"
Set oRs = DB.OpenResultset(sSQL)
sDesc = oRs!Description