ADO API Reference (ADO Method)

zhaozj2021-02-17  55

CreateParameter method

Create a new Parameter object using the specified property.

grammar

Set parameter = command.createParameter (Name, Type, Direction, Size, Value)

return value

Returns the Parameter object.

parameter

Name Optional, string, represents the Parameter object name.

TYPE Optional, long integer value, specify the parameter object data type. See the TYPE attribute about the effective settings.

Direction optional, long integer value, specify the parameter object type. See the Direction attribute for effective settings.

Size optional, long integer value, specifying the maximum length (in units of characters or bytes).

Value optional, variable body, specify the value of the Parameter object.

Description

Use the CreateParameter method to create a new Parameter object with the specified name, type, direction, size, and value. All values ​​transmitted in the parameter will be written to the corresponding parameter properties.

This method cannot automatically append the Parameter object to the parameter collection of the Command object, so that additional properties can be set. If the Parameter object is appended to a collection, the ADO will make the value of the additional property take effect.

If you specify the data type of the variable length in the Type parameter, you must transfer the SIZE parameter or set the size property of the Parameter object before you append it to the parameters collection; otherwise an error will occur.

CreateRecordset method (RDS)

Create an unconnected empty record set.

grammar

Object.createRecordset (ColumnInfos)

parameter

Object object variables represent RDSServer.DataFactory or RDS.DataControl objects.

The variant array of columnsinfos arrays is used to define each column of the Recordset created. The definition of each column contains an array having the following four desired properties.

Property Description Name column header name. TYPE integer data type. SIZE is independent of the characterization of characters, and is independent of the data type. Nullability Boolean value.

The set of column array is combined into an array to define the Recordset.

Description

Server-side business objects can use the AdoDb.Recordset generated by data from non-OLE DB data providers, such as operating system files containing stock share.

The following table lists the data types supported by the CreateRecordset method for the RDSserver.DataFactory object, where the number is numbered is a reference number for defining the field.

Each data type can be a fixed length or a variable length. The size of the fixed length type should be defined as -1 because the size of its size is still required for its size. Variable length data type size allows range from 1 to 32767.

For some variable data types, the type can be enforced to the type indicated in the Replace column. Only after you create and fill in the Recordset, you can see the actual data type if necessary.

Alternatively a fixed length constant number adTinyInt16 fixing adSmallInt2 fixing adInteger3 fixing adBigInt20 fixing adUnsignedTinyInt17 fixing adUnsignedSmallInt18 fixing adUnsignedInt19 fixing adUnsignedBigInt21 fixing adSingle4 fixing adDouble5 fixing adCurrency6 fixing adDecimal14 fixing adNumeric131 fixing adBoolean11 fixing adError10 fixing adGuid72 fixing adDate7 fixing adDBDate133 fixing adDBTime134 fixing adDBTimestamp1357 variable adBSTR8130 variable adChar129200 Variable AdvarChar200 variable adwcharchar201200 variable adwchar130 variable advarwchar202130 variable adLongvarwchar203130 variable adbinary128 variable advarbinary204 variable adlongvarbinary205204delete method (Ado parameters collection)

Remove the object from the Parameters collection.

grammar

Parameters.delete Index

parameter

Index string, the representative will delete the ± name, or the sequential location (index) of the object in the collection.

Description

Use the delete method on the collection to delete an object in the collection. This method is only valid for the Parameters collection of the Command object. The Name attribute of the Parameter object must be used when calling the Delete method, or its set index - object variable is invalid parameters.

DELETE method (ADO Fields collection)

Remove the object from the fields collection.

grammar

Fields.Delete Field

parameter

Field variants, specify the field object to be deleted. This parameter must be a Field object name without a serial number or a Field object itself.

Description

Calling the Fields.delete method for the opened Recordset will cause operation

DELETE method (Ado Recordset)

Delete the current record or record group.

grammar

RecordSet.delete AffECTRECORDS

parameter

AffectRecords affectenum value, determine the number of records affected by the Delete method, which can be one of the following constants.

Constant illustrates AdaffectCurrent default. Only delete the current record. AdaffectGroup deletes records that meet the current FILTER property settings. To use this option, you must set the Filter property to be one of the valid predefined constants. Adaffectall deletes all records. AdAffectallchapters deletes all subset records.

Description

Use the Delete method to mark the current record or set of records in the RecordSet object as delete. If the Recordset object does not allow deletion records to raise an error. Using the Immediate Update Mode will be removed immediately in the database, otherwise the log is marked as from the cache delete, the actual delete will be performed when the UpdateBatch method is called. (Use the Filter property to view deleted records).

Retrieving a field value from the deleted record will raise an error. After deleting the current record, the record that has been deleted before moving to other records will remain the current record. Once you leave the deleted record, you can't access it again.

If you are nest in your transaction, you can use the RollbackTrans method to recover the deleted record. If you are in a batch update mode, you can cancel one or a group of hangs can be canceled with a CancelBatch method.

If the deletion record fails due to the basic data conflict (such as the record has been deleted by other users), the provider returns a warning to the ERRORS collection but does not terminate the program execution, only the conflict occurs on all records of the request. Time error. If the Unique Table dynamic property is set, and Recordset is the result of performing a JOIN operation for multiple tables, then the delete method will only delete the rows in the table named after the Unique Table property.

Execute Method (ADO Command)

Perform the query, SQL statement, or stored procedure specified in the CommandText property.

grammar

For the Command returned by row:

Set recordset = command.execute (Recordsaffected, Parameters, Options)

Command returned for non-row:

Command.execute Recordsaffected, Parameters, Options

return value

Returns the Recordset object reference.

parameter

Recordsaffected options, long integer variables, the number of records that the provider has returned to its return. The RecordSaffected parameter is only applied to the operational query or stored procedure. Recordsaffected does not return the number of records returned by the query or stored procedure returned by the return result. For more information, please use the RecordCount property.

Parameters Optional, variant array, using the parameter value transmitted by the SQL statement. (The output parameter will not return the correct value when transmitting this parameter.)

Options optional, long integer value, indicating how the provider calculates the CommandText property of the Command object. This value can be one of the following constants:

Constant Description ADCMDText Indicates that the provider should calculate the CommandText in accordance with the text of the command (such as SQL statement). AdoccTable Indicates that ADO should generate a SQL query to return all rows from a table named in CommandText. The AdcmdTableDirect indicates that the provider should return all rows from the table named in CommandText. The AdcmdStoredProc indicates that the provider should calculate the CommandText by the stored procedure. AdcmDunkNown indicates unknown command type in CommandText. The ADASYNCEXECUTE indicates that the command should be executed asynchronously. ADASYNCFETCH indicates that the remaining behavior after the initial number specified by the Cachesize property should use asynchronous extraction.

See the CommandType properties for the first four regular details in this list.

Description

Execute methods using the Command object can perform the query specified in the COMMANDText property of the object. If the CommandText property specifies that the resulting result will be stored in the new Recordset object by rising queries. If the command is not a query by row, the provider returns a close-off Recordset object. Some application languages ​​allow ignore the return value (if no Recordset is required).

If the query has parameters, the current value of the parameters in the Command object will be used, unless the parameters transmitted via the Execute call. The parameter subset can be overwritten by omitting the new value of certain parameters when calling the Execute method. The order of the specified parameters is the same as the order in which it is transmitted in the method. For example, if there are 4 (or more) parameters and want to transmit new values ​​for the first and fourth parameters, array (var1,, var 4) can be transmitted as parameters parameters.

Note that the output parameter will not return the correct value when transmitting in the Parameters parameter.

The EXECUTECOMPLETE event will be issued after this operation.

Execute Method (ADO Connection) Execute the specified query, SQL statement, stored procedure, or text of the specific provider.

grammar

Command string returned by non-row:

Connection.execute Commandtext, Recordsaffected, Options

For the command string returned by row:

Set recordset = connection.execute (CommandText, Recordsaffected, Options)

return value

Returns the Recordset object reference.

parameter

CommandText strings, contain text of SQL statements, table names, stored procedures, or specific providers to be executed.

Recordsaffected options, long integer variables, the number of records that the provider has returned to its return.

Options optional, long integer value, indicating how the provider should calculate the commandText parameter, which can be the following value:

Constant Description ADCMDText Indicates that the provider should calculate the CommandText by the text definition of the command. AdoccTable Indicates that ADO should generate a SQL query to return all rows from a table named in CommandText. The AdcmdTableDirect indicates that the provider should return all rows from the table named in CommandText. Adcmdtable instructions should calculate the CommandText by the table name. The AdcmdStoredProc indicates that the provider should calculate the CommandText by the stored procedure. AdcmDunkNown indicates that the command type in the CommandText parameter is unknown. The AdaSyncexecute indication command should be executed asynchronously. ADASYNCFETCH indicates that the remaining row after the initial number specified in the Cachesize property is subjected to asynchronous extraction.

See the CommandType properties for the first four regular details in this list.

Description

Using the Execute method of the Connection object, any query that is transmitted to the method in the CommandText parameter of the specified connection is performed. If the CommandText parameter specifies the query returned by the row, any result that is generated will be stored in the new Recordset object. If the command is not a query returned by the line, the provider returns the close-off Recordset object.

The returned Recordset object is always read-only, forward only the cursor. If a RECORDSET object with more features should first create the RecordSet object with the desired property setting, then use the RECORDSET object's Open method to perform a query and return the desired cursor type.

The content of the CommandText parameter is specific to the provider, and can be any special command format that the standard SQL syntax or provider supports.

The ExecuteComplete event will be generated after this operation is completed.

Find method

Search for records in RecordSet to meet the specified criteria. If the standard is met, the recordset location is set on the found record, otherwise the location will be set at the end of the recordset.

grammar

Find (criteria, Skiprow, SearchDirection, START)

parameter

The criteria string contains statements that specify the column names, comparison operators and values ​​for search.

Skiprows optional, long integer value, its default value is zero, specifies the displacement of the current line or START bookmark to start search.

SEARCHDIRECTION Optional SearchDirectionsNum value, specifying the search from the current line or the next valid line. Its value can be ADSearchForward or AdSearchBackward. Search is determined by the SearchDirection value at the beginning of the record set or end end by the SearchDIRECTION value.

START optional, variant type bookmarks are used as the start position of the search.

Description

The "comparison operator" in criteria can be ">" (greater than), "<" (less than), "=" (equal to), "> =" (greater than or equal), "<=" (less than or equal) "<>" (Not equal) or "like" (pattern match). The value in criteria can be a string, floating point, or date. The string value is bound by single quotes (such as "State = 'WA'"). The date value is bound by "#" (digital marker) (such as "start_date> # 7/22/97 #").

If the "Comparison Operator" is "Like", the string "value" can contain "*" (a character can have only one or more times) or "_" (a character only occurs once). (, As "State Like M_ *" matches MAINE and MASSACHUSETTS.).

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

New Post(0)