DataTableReader.GetSchemaTable Method ()


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Returns a DataTable that describes the column metadata of the DataTableReader.

Namespace:   System.Data
Assembly:  System.Data (in System.Data.dll)

override GetSchemaTable : unit -> DataTable

Return Value

Type: System.Data.DataTable

A DataTable that describes the column metadata.

Exception Condition

The DataTableReader is closed.

The GetSchemaTable method returns metadata about each column in the following order:

DataReader column



The name of the column as it appears in the DataTable.


The ordinal of the column


-1 if the ColumnSize (or MaxLength) property of the DataColumn cannot be determined or is not relevant; otherwise, 0 or a positive integer that contains the MaxLength value.


If the column type is a numeric type, this is the maximum precision of the column. If the column type is not a numeric data type, this is a null value.


If column data type has a scale component, return the number of digits to the right of the decimal point. Otherwise, return a null value.


The underlying type of the column.


The indicator of the column's data type. If the data type of the column varies from row to row, this value is Object. This column cannot contain a null value.


true if the data type of the column is String and its MaxLength property is -1. Otherwise, false.


true if the AllowDbNull constraint is set to true for the column; otherwise, false.


true if the column cannot be modified; otherwise false.


false, for every column.


true: No two rows in the DataTable can have the same value in this column. IsUnique is guaranteed to be true if the column represents a key by itself or if there is a constraint of type UNIQUE that applies only to this column. false: The column can contain duplicate values in the DataTable. The default of this column is false.


true: The column is one of a set of columns that, taken together, uniquely identify the row in the DataTable. The set of columns with IsKey set to true must uniquely identify a row in the DataTable. There is no requirement that this set of columns is a minimal set of columns. This set of columns may be generated from a DataTable primary key, a unique constraint or a unique index. false: The column is not required to uniquely identify the row. This value is true if the column participates in a single or composite primary key. Otherwise, its value is false.


true: The column assigns values to new rows in fixed increments. false: The column does not assign values to new rows in fixed increments. The default of this column is false.


The name of the catalog in the data store that contains the column. Null if the base catalog name cannot be determined. The default value for this column is a null value.


This value is always Null.


The name of the DataTable.


The name of the column in the DataTable.


The value of the DataTable's AutoIncrementSeed property.


The value of the DataTable's AutoIncrementStep property.


The value of the DataColumn's DefaultValue property.


The expression string, if the current column is an expression column and all columns used in the expression belong to the same T:System.Data.DataTable that contains the expression column; otherwise null.


The MappingType value associated with the DataColumn. The type can be one of Attribute, Element, Hidden, or SimpleContent. The default value is Element.


The value of the DataTable's Namespace property.


The value of the DataColumn's Namespace property.

The following console application example retrieves schema information about the specified column. Pass the DisplaySchemaTableInfo procedure a DataTableReader and an integer representing the ordinal position of a column within the DataTableReader, and the procedure outputs schema information to the console window.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top