Attributes, methods, events, and constants of ADO three major objects (3)

zhaozj2021-02-17  48

ADO's three major objects properties, methods, events, and constants (3) RecordSet object Properties Name Data Types and Use AbsolutePage Readable LONG Type, or return the current record where the page number is located, 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. Variant GetRows returns a 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 cleavage (VBCR is the default), StrnullexPR is an optional parameter that is used to encounter an alternate value when a NULL value (the default is empty string).

The main purpose of GetString is to process the MSFLEXGRID or MSHFLEXGRID control MOVE * from the current record moving record pointer by setting the CLIP attribute of the control to StrClip. Calling syntax: Rstname.move LNGNUMRECORDS [, VARSTART], where LNGNumRecords is the number of records to be skipped, and optional parameter varStart specifies where to start moving. Its value is either a Bookmark value, or the 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 Records that have not been processed by the data source (only applicable to bulk update mode) LockType properties Use constant constant constant ADLockRecordonly Specify read-only access (default) AdlockBatchOptimistic uses bulk update modes instead of the default update mode AdlockOptimistic uses optimistic locks (only In the update process, you can lock the record or page) AdlockPESSIMISTIC uses pessimistic lock (editing or updating all procedures) State constant constant meaning adstateclosed connection (or other object) is off (default) AdstateConnecting is connecting data sources Status AdStateexecuting Conne The Execute method of CTION or Command object has been called AdStateFetching Return (ROW) to RecordSet Object AdStateOpen Connection (or other object) is the constant used by the open (active) status property (only for BATCH or BULK RECORDSET operation) constant meaning adRecOK successfully updated adRecNew successfully added adRecModified successfully modified adRecDeleted successfully removed adRecUnmodified no change adRecInvalid unsaved: Bookmark property is not adRecMultipleChanges unsaved: save will affect other records adRecPendingChanges unsaved: record quoted a wait insertion adRecCanceled unsaved: operation was canceled AdreccantRelease is not saved: Existing recorded values ​​Block Save AdrecConcurrencyviolation Not Save: Optimacy and Shock ADRECINTEGRITYVIOLATION ON:

转载请注明原文地址:https://www.9cbs.com/read-29554.html

New Post(0)