Promotic

Open - method of the AdoRecordset object

Description:
Opens a database element that gives you access to records in a table, the results of a query, or to a saved AdoRecordset.
Syntax:
Variant Open([String Source], [String actconn], [Long cursortyp], [Long locktyp], [Long opt])
Parameters:
Source[optional](String) Specifies a data source. The source parameter may be one of the following:
A URL
A relative/full file path name
A Command object
An SQL statement
A stored procedure
A table name
.
actconn[optional](String) A connection string or a Connection object.
cursortyp[optional](Long) The CursorTypeEnum value that specifies the type of cursor to use when opening a AdoRecordset object. The default value is adOpenForwardOnly.
-1 - adOpenUnspecified Unspecified type of cursor.
0 (default) - adOpenForwardOnly A forward-only cursor. This improves performance when you need to make only one pass through a AdoRecordset object.
1 - adOpenKeyset A keyset cursor. Like a dynamic cursor, except that you can't see records that other users add, although records that other users delete are inaccessible from your AdoRecordset object. Data changes by other users are still visible.
2 - adOpenDynamic A dynamic cursor. Additions, changes, and deletions by other users are visible, and all types of movement through AdoRecordset object are allowed.
3 - adOpenStatic A static cursor. A static copy of a set of records that you can use to find data or generate reports. Adding, changes, or deletions by other users are not visible.
locktyp[optional](Long) The CursorTypeEnum value that specifies the type of locking on a AdoRecordset object. The default value is adLockReadOnly.
-1 - adLockUnspecified Unspecified type of lock. Clones inherits lock type from the original Recordset.
1 (default) - adLockReadOnly Read-only records.
2 - adLockPessimistic Pessimistic locking, record by record. The provider lock records immediately after editing.
3 - adLockOptimistic Optimistic locking, record by record. The provider lock records only when calling update.
4 - adLockBatchOptimistic Optimistic batch updates. Required for batch update mode.
opt[optional](Long) Specifies how to evaluate the source parameter if it is not the Command object. Can be one or more CommandTypeEnum or ExecuteOptionEnum values.
 
CommandTypeEnum
-1 - adCmdUnspecified Unspecified type of command.
1 - adCmdText Evaluates CommandText as a textual definition of a command or stored procedure call.
2 - adCmdTable Evaluates CommandText as a table name whose columns are returned by an SQL query.
4 - adCmdStoredProc Evaluates CommandText as a stored procedure name.
8 (default) - adCmdUnknown Unknown type of command.
256 - adCmdFile Evaluates CommandText as the file name of a persistently stored Recordset. Used with AdoRecordset, Open or Requery only.
512 - adCmdTableDirect Evaluates CommandText as a table name whose columns are all returned. Used with AdoRecordset object. Open or Requery only. To use the Seek method, the AdoRecordset object must be opened with adCmdTableDirect. Cannot be combined with the ExecuteOptionEnum value adAsyncExecute.
 
ExecuteOptionEnum
-1 - adOptionUnspecified Unspecified command.
16 - adAsyncExecute The command should execute asynchronously. Cannot be combined with the CommandTypeEnum value adCmdTableDirect.
32 - adAsyncFetch The remaining rows after the initial quantity specified in the CacheSize property should be retrieved asynchronously.
64 - adAsyncFetchNonBlocking The main thread never blocks while retrieving. If the requested row has not been retrieved, then the current row automatically moves to the end of the file. If you open the AdoRecordset object from a Stream containing a persistently stored AdoRecordset object, then adAsyncFetchNonBlocking will not have an effect; the operation will be synchronous and blocking. adAsynchFetchNonBlocking has no effect if the adCmdTableDirect option is used to open the AdoRecordset object.
128 - adExecuteNoRecords The command text is a command or stored procedure that does not return rows. If any rows are retrieved, then they are discarded and not returned. adExecuteNoRecords can only be passed as an optional parameter to the Command or Connection Execute method.
256 - adExecuteStream The results of a command execution should be returned as a stream. adExecuteStream can only be passed as an optional parameter to the Command Execute method.
512 - adExecuteRecord The CommandText is a command or stored procedure that returns a single row which should be returned as a Record object.
See also:
- AdoRecordset.Filter (property)
Example:
JavaScriptVBScriptSelect and copy to clipboard

var sConnStr = "provider=SQLOLEDB;Server=.\\SQLEXPRESS;Database=pm_data;Uid=pm_admin;Pwd=pmadmin;";
oRs.Open("table1", sConnStr);
PROMOTIC 9.0.21 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.