Share via


SqlCeDataReader.GetSchemaTable Method

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

Namespace: System.Data.SqlServerCe
Assembly: System.Data.SqlServerCe (in system.data.sqlserverce.dll)

Syntax

'Declaration
Public Overrides Function GetSchemaTable As DataTable
'Usage
Dim instance As SqlCeDataReader
Dim returnValue As DataTable

returnValue = instance.GetSchemaTable
public override DataTable GetSchemaTable ()
public:
virtual DataTable^ GetSchemaTable () override
public DataTable GetSchemaTable ()
public override function GetSchemaTable () : DataTable
Not applicable.

Return Value

A DataTable that describes the column metadata.

Exceptions

Exception type Condition

InvalidOperationException

The operation is not valid. The SqlCeDataReader may be positioned after the last row in the result set.

Remarks

If SqlCeDataReader is reading columns from more than one base table, SqlCeDataReader will not populate the schema table with IsKey values. This behavior is similar to what happens when you have a SELECT query:

SELECT FirstName, LastName, 1+2 FROM Employees  

The query is reading columns from two different tables, the Employees table in the Northwind database and the temporary table created for 1+2.

The GetSchemaTable method maps to the OLE DB IColumnsRowset::GetColumnsRowset method, and returns metadata about each column in the following order:

Schema Table Column

Description

ColumnName

The name of the column. This name might not be unique. If the name cannot be determined, a null value is returned. This name always reflects the most recent renaming of the column in the current view or command text.

ColumnOrdinal

The ordinal of the column. The ordinal number starts with zero. SQL Server Compact Edition does not support bookmarks.

ColumnSize

The maximum possible length of a value in the column. For columns that use a fixed-length data type, the maximum length is the size of the data type.

NumericPrecision

If ProviderType is a numeric data type, the maximum precision of the column. The precision depends on the definition of the column. If ProviderType is not a numeric data type, a null value.

NumericScale

If ProviderType is DBTYPE_DECIMAL or DBTYPE_NUMERIC, the number of digits to the right of the decimal point. Otherwise, this is a null value.

IsUnique

If true, no two rows in the base table—which is the table returned in BaseTableName—can have the same value in this column. IsUnique is guaranteed to be true if the column constitutes a key by itself or if there is a constraint of type UNIQUE that applies only to this column. If false, the column can contain duplicate values in the base table. The default of this column is false.

IsKey

If true, the column is one of a set of columns in the rowset that, taken together, uniquely identify the row. The set of columns with IsKey set to true must uniquely identify a row in the rowset. There is no requirement that this set of columns is a minimal set of columns. This set of columns may be generated from a base table primary key, a unique constraint, or a unique index. If false, the column is not required to uniquely identify the row.

BaseColumnName

The name of the column in the data store. The name is a null value if the base column name cannot be determined or if the rowset column is derived, but not identical to, a column in the data store. The default of this column is a null value.

BaseTableName

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

DataType

Maps to the .NET Framework type of the column.

AllowDBNull

Set if the consumer can set the column to a null value or if the provider cannot determine whether or not the consumer can set the column to a null value. Otherwise, not set. A column may contain null values, even if it cannot be set to a null value.

ProviderType

The indicator of the column's data type. This column cannot contain a null value.

IsAutoIncrement

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

IsRowVersion

Set if the column contains a persistent row identifier that cannot be written to, and has no meaningful value except to identify the row.

IsLong

Set if the column contains a Binary Long Object (BLOB) that contains very long data.

IsReadOnly

If true, the column can be modified. If false, the column cannot be modified.

Platforms

Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows XP Professional x64 Edition, Windows XP SP2

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Framework

Supported in: 3.0

.NET Compact Framework

Supported in: 2.0, 1.0

See Also

Reference

SqlCeDataReader Class
SqlCeDataReader Members
System.Data.SqlServerCe Namespace