Opens a cursor (read-only by default).
recordset.Open Source, ActiveConnection, CursorType, LockType, Options
The parts of the Open statement syntax are described in the following table.
Part | Description |
---|---|
Source | Required. A Variant that evaluates to a table name or a SQL statement (see below). |
ActiveConnection | Optional. A Variant that evaluates to a String containing a definition for a connection. If supplied, it can only be "" since this property has no meaning on CE. |
CursorType
adOpenForwardOnly 0
adOpenDynamic 2 |
Optional. Default adOpenForwardOnly. Supports the following two values. All other values should generate a run-time error. Forward-only cursor. Identical to a static cursor except that you can only scroll forward through records. This improves performance in situations when you only need to make a single pass through a recordset. (Default.) Dynamic cursor. Additions, changes, and deletions by other users are visible, and all types of movement through the recordset are allowed, except for bookmarks if the provider doesn't support them. It is extremely important that the default behavior be forward-only, read-only. Note that the forward-only portion maps well to pegdb_autoincrement. |
LockType | Optional. A LockTypeEnum value that determines what type of locking (concurrency) the provider should use when opening the Recordset. Can be one of the following constants: adLockReadOnly (1), adLockPessimistic (2), adLockOptimistic (3) or adLockBatchOptimistic. However only adLockReadOnly and adLockOptimistic will be honoured, and all other requests will result in a cursor type of adLockOptimistic. |
Options | Optional. A CommandTypeEnum value that indicates how the provider should evaluate the Source argument. |
Sets or returns one of the following CommandTypeEnum values:
Constant | Value | Description |
---|---|---|
adCmdText | 1 | Evaluates Source as a textual definition of a command (i.e. SQL statement) |
adCmdTable | 2 | Evaluates Source as a table name. |
adCmdUnknown | 8 | The type of command in the Source property is not known. (Default.) |
Use the Options parameter to optimize evaluation of the Source property. If the Options property value equals adCmdUnknown (8), you may experience diminished performance because ADO must determine if the Source property by attempting to open as a table, stored procedure or as an SQL statement (in that order). If you know what type of command you're using, setting the Options property instructs ADO to go directly to the relevant code. If the Options property does not match the type of command in the Source property, an error occurs when you call the Open method.
When the Open method is called with a non-row returning SQL command (e.g. CREATE TABLE), no recordset is returned and the state of the recordset is closed.
The adLockReadOnly will have to be coded into ADO as PegDB doesn't support the concept of opening a table read-only.