The Connection Object - The OpenSchema Method
(Page 6 of 15 )
This method obtains database schema information from the provider.
Set Recordset = Connection.OpenSchema(Schema, _
[Criteria], [SchemaID])
| Parameter | Type | Description |
|---|
| Schema | SchemaEnum (Long) | The type of schema query to run |
| | |
| Criteria(Optional) | Variant | An array of query constraints for each Schema option (generally the column names and values to filter on) |
| | | |
| SchemaID(Optional) | Variant | The GUID for a provider-specific schema query not defined by the OLE DB specification |
| | |
Each value of SchemaEnum has a specific set of criteria values. This large list is included in Appendix B.
This method is most useful for obtaining table and procedure names from a data store. For example:
Set rsTables = objConn.OpenSchema(adSchemaTables)
While Not rsTables.EOF
Debug.Print rsTables("TABLE_NAME")
Debug.Print rsTables("TABLE_TYPE")
rsTables.MoveNext
Wend
The various schemas are examined in detail in Appendix D.
For multidimensional (OLAP) providers using adSchemaMembers, the restrictions can be either the columns in the members schema or one of the MDTREEOP constants, as defined in Appendix L.
An alternative method of obtaining schema information is to use the ADOX library, as discussed in Chapter 10.
The RollbackTrans Method This method cancels any changes made during the current transaction and ends the transaction.
Connection.RollbackTrans
All changes made since the previous BeginTrans will be cancelled. This affects only the most recently opened transaction, and like CommitTrans, you must resolve lower-level transactions before resolving higher-level ones.
Also, if the Connection object’s Attributes property is set to adXactCommitAbort, the provider automatically starts a new transaction after a RollbackTrans call.
Also see the BeginTrans method and the CommitTrans method.
This is from ADO Programmer's Reference, by Dave Sussman (Apress, ISBN 1590593421). Check it out at your favorite bookstore today. Buy this book now. |
Next: Properties of the Connection Object >>
More ASP.NET Articles
More By Apress Publishing