Both ADO and DAO provide Recordset objects, which are commonly used in code. In fact, many of the code samples in this chapter use recordsets. However, up to now, the recordset has been assigned a value based on the records returned as the result of executing an action.
Using the ADO Recordset object, you can implicitly execute an action by calling the Open method for the Recordset. Open retrieves the records from a data source based on the criteria and stores them in the Recordset object. It has five parameters, all of which are optional. The following table describes each of those parameters.
|Source||Optional. The Source argument can be a SQL statement, the name of a table, the name of a stored procedure, a URL, or a provider-specific text or command.|
|ConnectionString||Optional. The ConnectionString argument can be a Connection object or a Connection string.|
|CursorType||Optional. Specifies the type of cursor to use for the Recordset.|
|LockType||Optional. Specifies the type of lock to use for the Recordset.|
|Options||Optional. Specifies the command option(s) to use for the Recordset.|
Appendix F contains a list of all the available CursorType, LockType, and Options members and a description of those members. You can supply more than one Options value by using the Or operator; for example:
rs.Options = adCmdStoredProc Or adAsyncFetchNonBlocking
Suppose you need to create a recordset that is based ...