Contents Index Topic Contents |
OpenSchema Method - ADO
Obtains database schema information from the provider.
Applies To
Syntax
Set recordset = connection.OpenSchema (QueryType, Criteria, SchemaID)
Return Values
Returns a Recordset object that contains schema information.
Parameters
QueryType The type of schema query to run. Can be any of the constants listed below.
Criteria Optional. An array of query constraints for each QueryType option, as listed below.
QueryType values Criteria values adSchemaAsserts CONSTRAINT_CATALOG
CONSTRAINT_SCHEMA
CONSTRAINT_NAMEadSchemaCatalogs CATALOG_NAME adSchemaCharacterSets CHARACTER_SET_CATALOG
CHARACTER_SET_SCHEMA
CHARACTER_SET_NAMEadSchemaCheckConstraints CONSTRAINT_CATALOG
CONSTRAINT_SCHEMA
CONSTRAINT_NAMEadSchemaCollations COLLATION_CATALOG
COLLATION_SCHEMA
COLLATION_NAMEadSchemaColumnDomainUsage DOMAIN_CATALOG
DOMAIN_SCHEMA
DOMAIN_NAME
COLUMN_NAMEadSchemaColumnPrivileges TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAME
COLUMN_NAME
GRANTOR
GRANTEEadSchemaColumns TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAME
COLUMN_NAMEadSchemaConstraintColumnUsage TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAME
COLUMN_NAMEadSchemaConstraintTableUsage TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAMEadSchemaForeignKeys PK_TABLE_CATALOG
PK_TABLE_SCHEMA
PK_TABLE_NAME
FK_TABLE_CATALOG
FK_TABLE_SCHEMA
FK_TABLE_NAMEadSchemaIndexes TABLE_CATALOG
TABLE_SCHEMA
INDEX_NAME
TYPE
TABLE_NAMEadSchemaKeyColumnUsage CONSTRAINT_CATALOG
CONSTRAINT_SCHEMA
CONSTRAINT_NAME
TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAME
COLUMN_NAMEadSchemaPrimaryKeys PK_TABLE_CATALOG
PK_TABLE_SCHEMA
PK_TABLE_NAMEadSchemaProcedureColumns PROCEDURE_CATALOG
PROCEDURE_SCHEMA
PROCEDURE_NAME
COLUMN_NAMEadSchemaProcedureParameters PROCEDURE_CATALOG
PROCEDURE_SCHEMA
PROCEDURE_NAME
PARAMTER_NAMEadSchemaProcedures PROCEDURE_CATALOG
PROCEDURE_SCHEMA
PROCEDURE_NAME
PARAMTER_TYPEadSchemaProviderSpecific See Remarks adSchemaProviderTypes DATA_TYPE
BEST_MATCHadSchemaReferentialConstraints CONSTRAINT_CATALOG
CONSTRAINT_SCHEMA
CONSTRAINT_NAMEadSchemaSchemata CATALOG_NAME
SCHEMA_NAME
SCHEMA_OWNERadSchemaSQLLanguages <none> adSchemaStatistics TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAMEadSchemaTableConstraints CONSTRAINT_CATALOG
CONSTRAINT_SCHEMA
CONSTRAINT_NAME
TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAME
CONSTRAINT_TYPEadSchemaTablePrivileges TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAME
GRANTOR
GRANTEEadSchemaTables TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAME
TABLE_TYPEadSchemaTranslations TRANSLATION_CATALOG
TRANSLATION_SCHEMA
TRANSLATION_NAMEadSchemaUsagePrivileges OBJECT_CATALOG
OBJECT_SCHEMA
OBJECT_NAME
OBJECT_TYPE
GRANTOR
GRANTEEadSchemaViewColumnUsage VIEW_CATALOG
VIEW_SCHEMA
VIEW_NAMEadSchemaViewTableUsage VIEW_CATALOG
VIEW_SCHEMA
VIEW_NAMEadSchemaViews TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAME
SchemaID The GUID for a provider-schema schema query not defined by the OLE DB 1.1 specification. This parameter is required if QueryType is set to adSchemaProviderSpecific; otherwise, it is not used.
Remarks
The OpenSchema method returns information about the data source, such as information about the tables on the server and the columns in the tables.
The Criteria argument is an array of values that can be used to limit the results of a schema query. Each schema query has a different set of parameters that it supports. The actual schemas are defined by the OLE DB specification under the "IDBSchemaRowset" interface. The ones supported in ADO 1.5 are listed above.
The constant adSchemaProviderSpecific is used for the QueryType argument if the provider defines its own non-standard schema queries outside those listed above. When this constant is used, the SchemaID argument is required to pass the GUID of the schema query to execute. If QueryType is set to adSchemaProviderSpecific but SchemaID is not provided, an error will result.
Providers are not required to support all of the OLE DB standard schema queries. Specifically, only adSchemaTables, adSchemaColumns and adSchemaProviderTypes are required by the OLE DB specification. However, the provider is not required to support the Criteria constraints listed above for those schema queries.
Remote Data Service Usage The OpenSchema method is not available on a client-side (ADOR) Connection object.
Examples
OpenSchema Method Example (VB)
See Also
Using OLE DB Providers with ADO
Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.