ADO API Reference (DataSpace Object & Error Object & Field Object)

zhaozj2021-02-17  53

DataSpace pair (RDS)

The RDS.DataSpace object creates a client agent to customize the business object located in the middle layer.

Description

Remote Data Services requires a business object agent to communicate with the client component with the business object located in the intermediate layer. Agents easy to pack, unpack, and transfer (scheduling), unpacking, and transmits (scheduling).

Remote Data Services creates a business object agent using the CreateObject method of the RDS.DataSpace object. Regardless of the example of its corresponding intermediate business object, the business object agent is created dynamically. Remote Data Services support the following protocols: HTTP, HTTPS (HTTP Security Sockets), DCOM, and processes (client components and business objects are reside on the same computer).

The class ID of the RDS.DataSpace object is BD96C556-65A3-11D0-983A-00c04FC29E36.

Error object

ERROR objects contain details of data access errors related to a single operation (involving the provider).

Description

Any operation involving an ADO object will generate one or more provider errors. When each error occurs, one or more ERROR objects will be placed in the ERRORS collection of the Connection object. When another ADO operation generates an error, the ERRORS collection will be emptied and placed in the new Error object set.

Note that each Error object represents a specific provider error rather than an ADO error, and the ADO error is recorded in the exception processing mechanism at runtime. For example, in Microsoft Visual Basic, an error that generates a specific ADO will trigger an ORROR event and appear in an ERR object. For a complete list of ADO errors, see the ADO Error Code Theme.

Details of each error can be obtained through the attribute of the Error object, including the following:

Description attribute, contains the wrong text. The Number property contains a long integer value of an error constant. Source properties, identify the object that generates an error. After the request is issued to the data source, if there is multiple Error objects in the ERRORS collection, this property will be used. SQLSTATE and NATIVEERROR properties provide information from SQL data sources.

When the provider error occurs, the ERROR object will be placed in the ERRORS collection of the Connection object. The ADO support returns multiple errors by a single ADO operation to display an error message for a particular provider. To get rich error messages in the error handler, use the corresponding language or errors in the work environment, then use the nested loop to enumerate the properties of each Error object of the ErrorS collection.

Microsoft Visual Basic and VBScript If there is no valid Connection object, you need to retrieve the error message of the ERR object.

Like the provider, ADO will clear the OLE ERROR INFO object before making a new provider error. However, only when the provider generates a new error or CLEAR method, the ErrorS collection of the Connection object can be cleared and filled.

Some attributes and methods returned by the warnings appear in the way in ErrorS collection, but do not abort the execution of the program. In calling the RECORDSET object's Resync, UpdateBatch, or CancelBatch method, or the open method of the Connection object, or before the Filter property of the Recordset object, you can call the clear method of the ErrorS collection. This will read the COUNT property of the ErrorS collection to test the returned warning. Field object

The Field object represents the column of the data using a normal data type.

Description

The Recordset object contains a Fields collection consisting of Field objects. Each Field object corresponds to a column in the Recordset. Use the Value property of the field object to set or return the currently recorded data. Depending on the provider's different functions, certain collections, methods, or attributes of the field object may be invalid.

Use the collection, method, and properties of the Field object to do the following:

Use the NAME attribute to return a field name. Use the Value property to view or change the data in the field. Use Type, Precision, and NuMericsCale properties to return the basic characteristics of the field. Use the definedSize property to return to the declared field size. Use the ActualSize property to return the actual size of the data in a given field. Using Attributes properties and Properties collection can determine which types of functions for given fields are supported. Use the Appendchunk and getChunk methods to handle field values ​​that contain long binary or long character data. If the provider supports batch updates, you can use the OriginalValue and UnderlyingValue properties to resolve the difference between the field values ​​during the batch update.

All metadata properties (Name, Type, DefinedSize, Precision, and NuMericscale) are available before the RecordSet of the field object. Setting these properties at this time will help dynamically construct its format.

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

New Post(0)