Obtaining Schema Information from a Database
Obtaining schema information from a database is accomplished with the process of schema discovery. Schema discovery allows applications to request that managed providers find and return information about the database schema, also known as metadata, of a given database. Different database schema elements such as tables, columns, and stored-procedures are exposed through schema collections. Each schema collection contains a variety of schema information specific to the provider being used.
Each of the .NET Framework managed providers implement the GetSchema method in the Connection class, and the schema information that is returned from the GetSchema method comes in the form of a DataTable. The GetSchema method is an overloaded method that provides optional parameters for specifying the schema collection to return, and restricting the amount of information returned.
In addition to the GetSchema method, the .NET Framework Data Provider for OLE DB also exposes schema information using the GetOleDbSchemaTable method of the OleDbConnection object. GetOleDbSchemaTable takes as arguments an OleDbSchemaGuid that identifies the schema information to return, and an array of restrictions on those returned columns. GetOleDbSchemaTable returns a DataTable populated with the requested schema information.
In This Section
- Working with the GetSchema Methods
Describes the GetSchema method and how it can be used to retrieve and restrict schema information from a database.
- Understanding the Common Schema Collections
Describes all of the common schema collections supported by all of the .NET Framework managed providers.
- Understanding the Provider-Specific Schema Collections
Describes all of the specific schema collections supported by the .NET Framework managed providers and other drivers.
Describes the GetSchema method of the OleDbConnection class.
Describes the GetOleDbSchemaTable method of the OleDbConnection class.