asp.net.ph

OleDbConnection.GetOleDbSchemaTable Method

System.Data.OleDb Namespace   OleDbConnection Class


Returns the schema information of a data source.

[ VB ]
Public Function GetOleDbSchemaTable ( _
   ByVal schema As Guid, _
   ByVal restrictions ( ) As Object _
) As DataTable

[ C# ]
public DataTable GetOleDbSchemaTable (
   Guid schema,
   object [ ] restrictions
 );
[ C++ ]
public: DataTable* GetOleDbSchemaTable (
   Guid schema,
   Object* restrictions __gc [ ]
);

[ C++ ]
public function GetOleDbSchemaTable (
   schema : Guid,
   restrictions : Object [ ]
) : DataTable;

Parameters

schema
One of the OleDbSchemaGuid values that specifies the schema table to return.
restrictions
An array of objects that are filter values, each of which corresponds to a DataColumn in the resulting DataTable.

Return Value

A DataTable containing a list of schema restrictions.

Exceptions


Exception Type Condition
ArgumentException Occurs when the specified set of restrictions is invalid.
InvalidOperationException Occurs when the OleDbConnection is closed.
NotSupportedException Occurs when the specified schema rowset is not supported by the OLE DB provider.

Remarks

The schema information is returned as a DataTable that has the same columns structure as the OLE DB schema rowset specified by the given OleDbSchemaGuid value passed via the schema parameter.

Use the restrictions parameter to filter the rows to be returned in the DataTable ( for example, by specifying restrictions for tablename, type, owner, or schema ).

When you pass values in the restrictions array, include empty strings for array elements that do not contain values. If you pass an empty array to restrictions, all rows ( one for each table ) are returned in default order. Values in the array correspond to the order of the columns in the source table and DataTable.

The OleDbConnection method calls the underlying OLE DB IDBSchemaRowset::GetRowset method using standard common language runtime conversion rules.

You can retrieve information about literals by using DbInfoLiterals, which provides information equivalent to calling the OLE DB IDBInfo::GetLiteralInfo interface, or the ADO Connection.OpenSchema method with the adSchemaDBInfoLiterals constant.

Example

The following sample uses GetOleDbSchemaTable to return the list of tables from a database, that is then used to populate an HtmlSelect control.

 Show me 

See Also

OleDbConnection Members   OleDbSchemaGuid   Obtaining Schema Information from a Database Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph