Connection Object Properties Name Data Type and Used Attributes Read Write LONG Type, with two constants and specify whether to use retainning transactions. Constant ADXACTCommitRetaining indicates a new transaction when calling a committrans method; constant adxactabortretaning means that a new transaction is initiated when calling the RollbackTrans method. The default is 0, indicating that it does not use the retained transaction. CommandTimeout reads the long type to specify the time you must wait until the Execute call for a relevant Command object. The default is 30 seconds. Connectionstring readable String type, providing the data provider or service provider to open the specific information of the connection to the data source ConnectionTIMEOUT to read the long type, specifying the time required to wait for a failure CONNECTION.Open method call, default The value is 15 seconds. CursorLocation Reads LONG Type, determined to use the client (ADUSECLIENT) cursor engine, or use the server-side cursor engine. The default is aduseserver. DEFAULTDATABASE reads to write string types, if you do not specify a database name in ConnectString, use the name specified here. For SQL Server, its value is usually a Pubs ISOLATIONLEVEL readable long type, specifying and other concurrent transaction interactions. Or affairs. See the ISOLATIONLEVEL constant Mode long type, specify read and write permissions to Connection. See the MODE constant provider readable String type, if the NELE DB data or service provider's name is not specified in Connectionstring, use the name specified here. The default is MSDasql (Microsoft Ole DB Provider for ODBC). State Readable LONG Type, specifying the connection is in an open state, or is in a closed state or an intermediate state. See the State constant Version read-only String type, return to the ADO version number. Note: Most of the readable and writable properties listed above, only when the connection is in turn off, it is written. Only when the user uses the BeGintrans ... CommitTrans ... RollbackTrans method defines the specified for the degree of transaction isolation. If there are multiple database users to execute transactions at the same time, the application must specify how to respond to other transactions in the run.
Method method use BeGintrans initializes a transaction; there must be a committetrans and / or rollbacktrans Eating Close Close Connection CommitTrans submits a transaction to complete permanent changes to the data source (Begintrans method must be called before use) EXECUTE from SELECT SQL statements Returns a Forward-Only Recordset object, which is also used to perform those non-recomordSet statements, such as insert, update, delete query, or DDL statement Open to open a connection OpenSchema returns a RECORDSET object to provide data sources ( Metadata) ROLLBACKTRANS Cancels a transaction to restore temporary changes to data sources (Begintrans methods must be called before use) Note: Three methods of Execute, Open, and OpenSchema can accept variable parameters. Execute's syntax is: cnnname.execute strcommand, [lnGrowsaffected [, LNGOPTION] STRCOMMAND value can be a SQL statement, a table name, and a stored procedure name, or any string that the data provider can accept. In order to improve performance, it is best to specify a suitable value for the LNGOptions parameter (see the constant for the LNGOptions parameter) to enable the provider to explain the statement without determining its type. Optional parameters LNGROWSAFFECTED will return the number of INSERT, UPDATE, or DELETE queries. These queries returns an off Recordset object. A SELECT query will return the LNGROWSAFFECTED value of 0 and return Forward-Only RecordSet with a row or multi-line content. The event event name triggered the timing BegintransComplete Begintrans method. code:
Private sub cNNNAME_BEGINTRANSCOMPLET (Byval TransactionLevel As Long, Byval Perror As AdoDb.Error, Adstatus As Adodb.EventStatusenum, BYVAL PCONNECTION As adoDb.connection)
After the committranscomplete committrans method
code:
Private sub connection1_commitTranscomplete (Byval Perror As AdoDb.Error, Adstatus As Adod.EventStatusenum, ByVal PConnection As Adodb.Connection)
After the ConnectComplete successfully established the connection to the data source
code:
Private sub connection1_connectcomplete (byval perror as adoDb.error, adstatus as adodb.eventstatusenum, byval pconnection as adoDb.connection)
DiSConnect Connection is turned off
code:
Private sub connection1_disconnect (adstatus as adod.com.eventStatusenum, Byval PConnection as adoDb.connection) EXECUTECOMPLETE When Connection.execute or Command.execute is
code:
Private Sub Connection1_ExecuteComplete (ByVal RecordsAffected As Long, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pCommand As ADODB.Command, ByVal pRecordset As ADODB.Recordset, ByVal pConnection As ADODB.Connection)
InfubusSage An error object is added to the AdoDb.Connectio.Error collection
code:
Private sub connection1_infomessage (byval perror as adoDb.error, adstatus as adodb.eventstatusenum, byval pConnection as adodb.connection)
RollbackTranscomplete RollbackTransComplete RollbackTransComplete RollbackTransComplete RollbackTransComplete
code:
Private sub connection1_rollbacktranscomplete (byval perror as adoDb.Error, adstatus as adodb.eventstatusenum, byval pconnection as adoDb.connection)
WillConnect is about to call the Connection.open method
code:
Private sub connection1_willconnect (Connectionstring As String, Userid As String, Password As String, Options as long, adstatus as adodb.eventStatusenum, Byval PConnection As adoDb.connection)
Willexecute is about to call Connection.execute or Command.execute method
code:
Private Sub Connection1_WillExecute (Source As String, CursorType As ADODB.CursorTypeEnum, LockType As ADODB.LockTypeEnum, Options As Long, adStatus As ADODB.EventStatusEnum, ByVal pCommand As ADODB.Command, ByVal pRecordset As ADODB.Recordset, ByVal pConnection As ADODB.Connection )
Note: Name and meaning of the constant used in these Adstatus parameters. See the constant constant constant constant constant constant constant constant constant constant constant constant constant constant constant constant constant constant constantCursorsTability (default) AdxactBrowSe allows you to read other transactions. transaction does not cover the other change at a higher degree of isolation of the firm do adXactIsolated all transactions are independent adXactReadCommitted equivalent to adXactCursorStability adXactReadUncommitted equivalent to adXactBrowse adXactRepeatableRead read other prohibited transaction is equivalent to changing adXactSerializable adXactIsolated adXactUnspecified can not determine the degree of transaction isolation Mode providers Constant constant meaning admodeunknown's connection permission (default) AdmodeRead connection is read-only, read-writable AdmodesharedNynone does not reject other users' read and write access (the default value of Jet OLE DB Provider) AdmodesharedenyRead refuses other Users Open the read connection of the data source Admodesharedenywrite Reject other users to open the data source to open the data source AdmodeshareExClusive with exclusive ways to open the data source Admodewrite connection is only written State constant constant meaning adstateClosed Connection (or other object) is a closed (default) AdstateConnecting is connected to the statusExecuting connection or Command object's execute method has been called the adstroupet object AdstateOpen Connection (or other object) is open. (Activities) The constant of the LNGOPTION parameter in the execute method, the constant Command type constant sense adcmdunknown command type is undecided (default),
Data provider to discriminate Command syntax adcmdfile command is the object type The corresponding file name AdcmdStoredProc Command is a stored procedure name AdcmdTable Command is a table name that can generate internal Select * from tablename queries. AdcmdtableDirect Command is able to get rows directly from the table. Table Name AdcmdText Command is a SQL statement AdoDB event handle the constant constant constant constant constant constant in AdStatus ADSTATUSCANCEL operations Causes the AdstusCnatDeny operation cannot reject other users access AdstusErRorsoccurred operations cause errors and have been sent to the Errok operation. An unpredictable event is activated during the AdStatusnuNTedEvent operation, the main purpose of the Command object Command object is to perform a parameterized stored procedure. The form is either temporary preparation (prepared) or a precompiled SQL statement. If you want (store) one or more queries for multiple executions on the same connection, the Command object is also useful. When you want to create RecordSet, an efficient way is to bypass the commord set.open method. Property Name Data Type and Use ActiveConnection Pointer Type, pointing to the Connection object associated with Command. For existing open connections, set cmmname.activeConnection = cnnname can be used. Alternatively, a new connection can be created using a valid connection string without using the associated Connection object name. The default is NULL. CommandText reads the String type. Specify an SQL statement, a table name, a stored procedure name, or an arbitrary string that the provider can accept for ActiveConnection. The value of the CommandType property determines the format of the CommandText property value. The default value is empty string: "" CommandTimeout reads the long type, specifying the time you must wait until a Command.execute call is aborted. The value at this time is preferred in the set value in Connection.comAndTimeout. The default is 30 seconds. CommandType reads the long type, specifying how the data provider explains the CommandText property value. CommandType is equivalent to an optional parameter LNGOption in the Connection.execute method. See the constant used in CommandType for details. The default value is adcmdunkown. Name Read Write String Type, specify the name of the Command. Prepared can read the Boolean type, determine whether the data source compiles the SQL statement in CommandText to Prepared Statement. Prepared Statement is only available in the ActiveConnection life cycle of Command.
Many client / server RDBMS, including SQL Server, supports Prepared Statement. If the data source does not support Prepared Statement, set this property to true, which will result in a fallfrower error. State Readable LONG Type, specify the commnad status. See the State constant. Note: It is best to specify a suitable constant value for CommandType each time, otherwise the efficiency of the system operation will be reduced. Method Method Use CreateParameter must first declare an AdoDb.Parameter object first before performing this method. Call syntax: program code:
Cmmname.createParameter [Strname [, LNGTYPE [, LNGDIRECTION [, LNGSIZE [, VARVALUE]]]]]]]]]]]]]]]]]]]
Execute call syntax is the same as the connection.execute. Constant State Constant Constant Meaning adStateClosed Connection (or other objects) is a closed state (default) adStateConnecting is connected to the data source adStateExecuting Execute method Connection or Command object has been invoked adStateFetching returns rows (Row) to Recordset object adStateOpen Connection (or Other objects) is open (active) CommandType used constant CommandType Meaning ADCMDunkNown Command Type Up (Default) Process Name AdcmdTable Command is a table name that can generate internal Select * from Tablename queries. AdcmdtableDirect Command is a table name that can get row content directly from the table name AdcmdText Command is a SQL statement RECORDSET Object Property Name Data Type and Purpose AbsolutePage Read Write Long Type, either set or return the page number of the current record, or a positionenum constant, see the constant used by AbsolutePage. You must set the value of Pagesize before getting or setting the value of the ABSOLUTEPAGE. AbsolutePage is counting from 1. If the current record is at the first page, the return value of the AbsolutePage is 1, and the Absolute Point will give the current record pointer to the first record of the specified page. AbsolutePosition * Readable loong type (counting from 1), setting or returns location at the current record. The maximum value of AbsolutePosition is the value of the RecordCount property. ActiveCommand readable string type, the previously opened Command object name ActiveConnection pointer type, pointing to the previously opened Connection object associated with RecordSet, or pointing to a fully valid Connectionstring string value. BOF * read-only Boolean type, if true, indicates that the record pointer is already before the Recordset first record, and there is no current record bookmark * to read the VARIANT type, return to a reference to a specific record or use a Bookmark value to make the record pointer Point to a specific record cachesize * readable write long type, specify the number of records stored in the local cache, the smallest (default) is 1. If the value of the Cachesize is added, the number of communication with the server can be reduced when flowing RecordSet for more records.
CursorLocation reads the long type to specify the position of the flowable cursor, that is, the Cursortype is located at the client or the server side, see the constant used by CursorLocation. The default is the cursor provided using the OLE DB data source. Cusrsortype * Readable LONG type, specify the type of Recordset cursor, see the constant used by Cursortype, the default value is the forward-only cursor DataMber pointer type, pointing to the associated DataEnvironment.command object DataSource pointer type, pointing to the associated DataEnvironment.connection object EditMode * read-only the long type, return to the recordset's editing status, see the constant EOF * read-only Boolean type for EditMode, if true, indicating that the record pointer has exceeded the last record of the Recordset, and there is no current record. Filter * readable to write a Variant type, or one-piece expression (a valid SQL WHERE clarion but does not have a reserved word where), or point to the Bookmark array of specific records, or a Filter constant, see Filter A constant. LockType * Readable LONG type, specifying the recording lock method used to open RecordSet. The default is read-only, and corresponds to the read-only feature of the Forward-Only cursor. See the constant used by the LockType property. MarshalOptions can read the long type, specify which record collection should be returned after the client is changed, this property is only suitable for uncommon Ador.Recordset objects, which is one of the RDS.Ador.Recordset object members. MaxRecords * readable LONG type, specifying the maximum number of records returned by the SELECT query or stored procedure, the default value is 0, that is, all returned pageCount read-only LONG type, return all the number of pages of Recordset, you must set the value of PageSize, The return value of PageCount is really meaningful. If the Recordset does not support the PageCount property, the return value is -1 PageSize readable loong type, setting, or returns a logical page number of records included in the logical page. Use logic pages to decompose large RecordSet into multiple easily handled small parts. The usual approach is to set up the number of records that PageSize can display by DataGrid, MSFlexGrid, or hierarchical FlexGrid control. PageSize and lock Jet (2K) or lock SQL Server (6.5 editions and earlier versions, 2K; version 7.0, 8K) Database Table Signings When the table size is not related to the PERSISTFORMAT readable long, set, or returned by calling Save method The format of the Recordset file created.
There is only one value adpersistadtg (default format: Advanced Data TableGram) RecordCount * Read-only long type, if Recordset supports approximation or support bookmarks, return the number of records contained with the RECORDSET with the flowable cursor; if not supported, you must use The MOVELAST method is to achieve the accurate RECOrdcount value of all records. If the forward-only type recordset has one or more records, RecordSet returns -1 (TRUE), any type of empty Recordset will return 0 (false) sort * to read the String type, including a reserved word Order by SQL Ordery By clause to specify the sorting method of RecordSet Source * to read the String type, which can be a SQL statement, a table name, a stored procedure name, or a related Command object name. If a Command object name is provided, the source will return the value of Command.comMandText. The parameters of the Open method can specify the type of STATE-readable long type providing to the Source value, one of the object state constants. See the State constant STATUS read-only LONG type, indicating the status of the RecordSet or other multi-recorded (BULK) operation. See the constant used by the status property Note: The list of properties listed above is the standard properties of the AdoDB.Recordset object, that is, those that are supported by most Universal OLE DB data providers of the relational database. The property of the strap indicates that it is exactly the same or close to the corresponding attribute of the DAO.Recordset or RDORESultset object. Method Method Use AddNew * Add a new record to the updateable Recordset. Call the syntax for rstname.addnew [{varfield | avarfields}], {varValue | avarvaluese}], where varField is a single field name, and avarfields are field names. Varvalue is a single field value, and AvarValue is an array consisting of a value specified by avarfields. Call the UPDATE method to add the new record to the table of the database. If you add a record to the RecordSet of the first field, you must specify the name of the primary key in the AddNew method, Cancel cancel the execution of the asynchronous query, the abort store, or the composite SQL statement to create multiple RecordSet, call batch update operation will come into force syntax for rstName.Cancel CancelBatch * cancel Recordset LockEdit BatchOptimistic value of the call syntax is: rstName.CancelBatch [lngAffectRecords], optional parameter values lngAffectRecords see lngAffectRecords used with a constant Clone copy With a RECORDSET object with a stand-alone record pointer, call syntax is: set RSTDUPE = Rstname.clone () Close Close RecordSet object, will retrore the Recordset property and use the Open method to re-access the Recordset.
Calling syntax: Rstname.close delete * If the Recordset's LockedIt property value is not set to AdlockBatchOptimistic, immediately remove the current record Find from the Recordset and the corresponding table to meet the records that meet the specified condition. Calling syntax: rstname.finds, lngsearchdirection [, lngstart]], where strcriteria is a SQL WHERE clause that does not contain WHERE keywords, optional parameters LNGSKIPRecords is the number of records skipmed before application, LNGDirection designated Find the direction (AdSearchForward, and AdSearchForward, where AdSearchForward is the default value), the optional parameter lngstart specifies where to start search, its value is either a Bookmark value, or the Bookmark constant, see the Bookmark constant for the Varstart parameter. GetRows returns a variant two-dimensional array (row, column), call syntax avarname = rstName.GetRows (lngRows [, varStart [, {strFieldName | lngFieldIndex | avarFieldNames | avarFieldIndexes}]], which is the number of records returned lngRows rows, varStart designated Where start looking for, it is either a Bookmark value, or the Bookmark constant, see the Bookmark constant for the Varstart parameter. The third parameter can be a single column (field) name or index, or multiple column names Or the Variant array of indexes. If the third parameter is not specified, getRows returns all columns in the Recordset. GetString By default, returns the String string value of the specified number record, and the record is separated by the return code. Separate by Tab. the syntax is: strClip = rstname.GetString (lngRows, [, strCloumnDelimiter [, strRowDelimiter, [strNullExpr]]]) where the number of records to return lngRows rows, strColumnDelimiter optional column separator (the vbTab is the default), strRowDelimiter yes. The optional line division (VBCR is the default), StrnullexPr is an optional parameter, an alternate value when it comes to a null value (the default is empty string). The main purpose of the GetString is by setting the control CLIP property. To process the MSFLEXGRID or MSHFLEXGRID control Move * from the current record mobile record pointer. Call syntax is: Rstname.move LNGNUMRECORDS [, VARSTART], where LNGNumRecords is the number of records to be skipped, optional parameter varStart specifies where to start moving It is either a Bookmark value or a Bookmark constant, see the Bookmark constant for the Varstart parameter.
MoveFirst * Move the record pointer to the first record, call the syntax as: RstName.MoveFirst MoveLast * Move record pointer to the last record, call the syntax to move the record pointer to the next record, call the syntax: Rstname. MoveNext. It is the unique MOVEPREVIOS * mobile record pointer to the previous record, call the syntax to return the syntax to: RstName.MovePrevious next, which is usually a composite SQL statement that can generate multiple Recordset (eg Select * from Orders; select * from customers) or stored procedure to create. Call the syntax for next = rstname.nextRecordset [(LNGRecordsaffected), where optional parameter lngRecordsaffected specifies the number of records that return to RSTNext. If there is no RecordSet, RstNext is set to Nothing Open to open a Recordset on a active Command or Connection object, call syntax: RstName.Open [VARSOURCE [, VARACTIVECONNECTION [, LNGCURSORTYPE [, LNGLOCKTYPE [, LNGOPTIONS]]]]] . These parameters are optional, Requuery Re-acquires the contents of Recordset, equivalent to Close, and then OPEN. It is a resource set operation. The syntax is: RstName.Requery Resync * Re-slave the table to get part of the Recordset content. Call the syntax for RstName.Resync [LNGAFFECTRecords], where the value of LNGAffECTRecords see the constant used by LNGAffECTRecords. If this parameter is set to AdaffectCurrent or AdaffectGroup, it is less than the resources consumed than the Adaffectall (default). Save creates files that contain the RECORDSET permanent copy. Call the syntax for Rstname.save strfilename. Strfilename is the path and file name. Usually use .RST as an extension of the file. Supports Returns True if the data provider supports the specified cursor, otherwise returns to false. Call the syntax for supported = RstName.supports (LNGCURSorOptions). About LNGCURSorOptions, see the constant used by the Supports method. Update * enables the modification of the RecordSet to take effect on the table in the underlying data source. For bulk operations, the Update method only enables the modification to take effect on the local (Cached) Recordset. Calling syntax for rstname.Update updatebatch * Complex indication type RecordSet (LockType property value is adbatchoptimistic, CURSORTYPE Attribute Value AdopenKeySet or AdopenStatic) to change the table in the underlying data source. Call the syntax for RstName.Updatebatch [LNGAFFECTRECORDS], where the value of LNGAffECTRecords see the constant for LNGAffECTRecords. Note: AdoDB.Recordset object does not support Edit method.
In order to change the value of one or more fields currently recorded, you can use RstName.fields (n) .Value = varValue to change the value of the corresponding field to the value required, and then execute RstName.Update. Event Event Name Trigger Time EndofRecordset Record Pointer Try to move to the last record, the FieldChangeComplete field value is completed after the MoveComplete Move or Move ... method executes RecordSchangeComplete After completing a single record editing, the change in the RecordSetChangeComplete cache has taken effect on the underlying table Later, WillChangfield previously changed the Field value to change the change in the WillChangeRecordset cache before the WillChangeRecordset cache before the Single Record Change The WillMove Move or Move ... Method was executed before: The function header of the event handling module used the Adreason parameter. The value of this parameter see the constant used by the Adreason parameter. The constant constant constant constant meaning of the constant AbsolutePage property does not support the page, the Recordset is empty, or the data provider cannot determine the page number. The AdposboF record pointer is positioned at the beginning of the file (the BOF property value is true) adposeof record pointer positioning the constant constant constant constant constant constant constant constant meaning of the file in the end of the file (EOF property value true) CursorLocation property Using the cursor supplied by the client game.
AdoDB.Recordset requires client games ADUSERVER to use the cursor supplied by the data source, usually (but not absolute) is located on the server (default) Cursortype properties The constant constant meaning AdopenForwardonly provides one-way mobile cursors and read-only RecordSet (default) AdoPendynamic provides scrollable cursors to display other users' changes made by RecordSet (including add new records) AdoPenKeySet provides scrolling cursors, only hiding other users, similar to Dynaset Type DAO.Recordset AdoPenStatic offers a Recordset Scrollless cursors on static copy, similar to the snapshot type DAO.Recordset, but more constant constant editmode properties for constant constant meanings Adeditnone unsuccessful editing operation (default) AdeditAdd temporarily adds a record, but has not yet The data in the table stored in the database has been changed, but the constant constant meaning of the Filter property in the table has not been deposited in the database, and the existing filter is removed, displaying all records in the Recordset (equivalent to put Filter attribute is set to an empty string, the default value) adfilterAffectedRecords displays only the last recording affected CancelBatch, Delete, Resync or UpdateBatch method performed adFilterFetchedRecords only the current record in the Cache, the number of records determined by the CacheSize adFilterPendingRecords but has been modified to display only Not yet been data Source Processing Record (only available for Batch Update Mode) LockType Property Use Constant Constant Meaning AdlockRecordonly Specifies Read-only Access (Default) AdlockBatchOptimistic Use Batch Update Mode instead of the default Update mode AdlockOptimistic uses optimism lock (Update Process only) Locking record or page in the middle of the ADLOCKPESSIMISTIC uses pessimism (editing or updating the entire process)
State Constant Constant Meaning adStateClosed Connection (or other objects) is a closed state (default) adStateConnecting is connected to the data source adStateExecuting Execute method Connection or Command object has been invoked adStateFetching returns rows (Row) to Recordset object adStateOpen Connection (or other Object) is a) Status opening the properties (active use of constant (only for Batch or Bulk Recordset operation) constant meaning adRecOK successfully updated adRecNew successfully added adRecModified successfully modified adRecDeleted successfully removed adRecUnmodified no unsaved changes adRecInvalid: Bookmark property is invalid adRecMultipleChanges Not saved: Save will affect other records AdRecpendingChanges unsave: Record references a Waiting inserted operation AdreccanceLed unswed: Operation is canceled adReccantrelease un Save: Existing recorded values Block Save AdrecConcurrencyviolation Un Save: Optimacy and Shock ADRECINTEGRITYVIOLATION : Operation will affect the consistency AdystemaXChangeSexceed ED is not saved: There are too many waiting modifications AdrecObjectopen unsave: Open storage objects Conflict AdrecOutofMemory unsave: Memory is not saved: User permissions are not adeted enough for AdrecSchemaviolation: The recorded structure does not match the definition of the database does not save or save or save or save or saved or saved Delete: Record the constant Command type constant constant for the LNGAFFECTRecords parameter AdAffectAll includes all records of the RecordSet object, and those recorded by the Filter property filter also calculate (default) AdaffectCurrent only includes the current record ADAFFECTGROUP only those consistent Current Filter Conditions Record Varstart parameters Bookmark constant constant meaning adbookmarkcurrent starts from the current record (default)