Aracılığıyla paylaş


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

Reference

  • GetSchema
    Describes the GetSchema method of the OleDbConnection class.
  • GetOleDbSchemaTable
    Describes the GetOleDbSchemaTable method of the OleDbConnection class.

See Also

Other Resources

Connecting and Retrieving Data in ADO.NET