Condividi tramite


Visual Basic Concepts

Programming with Remote Data Objects

RDO objects and collections provide a framework for using code to create and manipulate components of a remote ODBC database system. Objects and collections have properties that describe the characteristics of database components and methods that you use to manipulate them. Using the containment framework, you create relationships among objects and collections, and these relationships represent the logical structure of your database system.

Figure 11.1 The RDO 2.0 object model

With the exception of the rdoEngine object, each of these objects is maintained in an associated collection. When RDO is initialized on first access, RDO automatically creates an instance of the rdoEngine and the default rdoEnvironments(0).

The Remote Data Object programming model is similar to the Data Access Objects (DAO) programming model in many respects. However, far more emphasis is focused on handling stored procedures and their result sets, and less emphasis is placed on data access retrieval methods used solely by ISAM programming models. The following table describes each of the objects.

RDO object Description
rdoEngine The base object. Created automatically when you first access RDO in your application.
rdoError Used to handle all ODBC errors and messages generated by RDO. Created automatically.
rdoEnvironment Defines a logical set of connections and transaction scope for a particular user name. Contains both open and allocated (but unopened) connections, provides mechanisms for simultaneous transactions, and provides a security context for data manipulation language (DML) operations on the database. rdoEnvironments(0) created automatically.
rdoConnection Represents an open connection to a remote data source and a specific database on that data source, or an allocated but as yet unconnected object, which can be used to subsequently establish a connection.
rdoTable Represents the stored definition of a base table or an SQL view.
rdoResultset Represents the rows that result from running a query.
rdoColumn Represents a column of data with a common data type and a common set of properties.
rdoQuery An SQL query definition that can include zero or more parameters.
rdoParameter Represents a parameter associated with an rdoQuery object. Query parameters can be input, output, or both.

Note   True distributed transactions can only be done between database management systems that support the Distributed Transaction Coordinator (DTC). At this time, only Microsoft SQL Server 6.5 supports this functionality. For more information about DTC, see "Using the rdoEnvironment Object to Manage Transactions" in this chapter.

Note   The RDO 1.0 rdoPreparedStatement object and rdoPreparedStatements collection are supported by RDO 2.0, but only for backward compatibility. You should convert your code to use the rdoQuery object and rdoQueries collection instead.