Retrieving Database Schema Information (ADO.NET)
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.
The .NET Framework Data Providers for OLE DB, ODBC, Oracle, and SqlClient provide a GetSchemaTable method that returns a DataTable describing the column metadata of the DataReader.
The .NET Framework Data Provider for OLE DB also exposes schema information by using the GetOleDbSchemaTable method of the OleDbConnection object. As arguments, GetOleDbSchemaTable takes 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
GetSchema and Schema Collections (ADO.NET)
Describes the GetSchema method and how it can be used to retrieve and restrict schema information from a database.Schema Restrictions (ADO.NET)
Describes schema restrictions that can be used with GetSchema.GetSchema Override (ADO.NET)
Describes how to override the default schema collections to retrieve schema metadata that is specific to a particular data source.Common Schema Collections (ADO.NET)
Describes all of the common schema collections supported by all of the .NET Framework managed providers.SQL Server Schema Collections (ADO.NET)
Describes the schema collection supported by the .NET Framework provider for SQL Server.Oracle Schema Collections (ADO.NET)
Describes the schema collection supported by the .NET Framework provider for Oracle.ODBC Schema Collections (ADO.NET)
Describes the schema collections for ODBC drivers.OLE DB Schema Collections (ADO.NET)
Describes the schema collections for OLE DB providers.
Reference
GetSchema
Describes the GetSchema method of the DbConnection class.GetSchema
Describes the GetSchema method of the OdbcConnection class.GetSchema
Describes the GetSchema method of the OleDbConnection class.GetSchema
Describes the GetSchema method of the OracleConnection class.GetSchema
Describes the GetSchema method of the SqlConnection class.GetSchemaTable
Describes the GetSchemaTable method of the DbDataReader class.GetSchemaTable
Describes the GetSchemaTable method of the OdbcDataReader class.GetSchemaTable
Describes the GetSchemaTable method of the OleDbDataReader class.GetSchemaTable
Describes the GetSchemaTable method of the OracleDataReader class.GetSchemaTable
Describes the GetSchemaTable method of the SqlDataReader class.