Visual Basic: RDO Data Control
An rdoTable object represents the stored definition of a base table or an SQL view.
Note You are discouraged from using the rdoTable object and rdoTables collection to manage or inspect the structure of your database tables. This object is maintained for backward compatibility and might not be supported in future versions of Visual Basic or RDO.
You can map a table definition using an rdoTable object and determine the characteristics of an rdoTable object by using its methods and properties. For example, you can:
- Examine the column properties of any table in an ODBC database. (Note that all rdoTable object properties are read-only.)
- Use the OpenResultset method to create an rdoResultset object based on all of the rows of the base table.
- Use the Name property to determine the name of the table or view.
- Use the RowCount property to determine the number of rows in the table or view. Referencing the RowCount property causes the query to be completed just as if you had used the MoveLast method.
- Use the Type property to determine the type of table. The ODBC data source driver determines the supported table types.
- Use the Updatable property to determine if the table supports changes to its data.
You cannot reference the rdoTable objects until you have populated the rdoTables collection because it is not automatically populated when you connect to a data source. To populate the rdoTables collection, use the Refresh method or reference individual members of the collection by their ordinal number.
When you use the OpenResultset method against an rdoTable object, RDO executes a "SELECT * FROM table" query that returns all rows of the table using the cursor type specified. By default, a forward-only cursor is created.
You cannot define new tables or change the structure of existing tables using RDO or the RemoteData control. To change the structure of a database or perform other administrative functions, use SQL queries or the administrative tools that are provided with the database.
The default collection of an rdoTable object is the rdoColumns collection. The default property of an rdoTable is the Name property. You can simplify your code by using these defaults. For example, the following statements are identical in that they both print the number corresponding to the column data type of a column in an rdoTable using a RemoteData control:
Print RemoteData1.Connection.rdoTables _ ("Publishers").rdoColumns("PubID").Type Print RemoteData1.Connection("Publishers"). _ ("PubID").Type
The Name property of an rdoTable object isn't the same as the name of an object variable to which it's assigned it is derived from the name of the base table in the database.
You refer to an rdoTable object by its Name property setting using this syntax:
rdoTables("Authors") 'Refers to the Authors table
rdoTables!Authors 'Refers to the Authors table
You can also refer to rdoTable objects by their position in the rdoTables collection using this syntax (where n is the nth member of the zero-based rdoTables collection):