views:

82

answers:

2
OleDbDataReader oleDbDataReader = oleDbCommand.ExecuteReader(CommandBehavior.KeyInfo);
DataTable dataTable = oleDbDataReader.GetSchemaTable();

How does GetSchemaTable() work?

Where does it get its information in RDBMS?

+1  A: 

From the system tables (e.g., syscolumns, sysobjects, etc) in each database.

marmstrong
Is this always the case, or does that depend on the OLE DB provider being used?
John Saunders
That's wrong. The result might be dynamic, a user might have no permission to view sysobjects (VIEW DEFINITION in MSSQL 2005+) etc.
VladV
A: 

GetSchemaTable() reads the metadata on the resultset returned by ADO.NET.

VladV