Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DataTableReader::GetDataTypeName Method (Int32)

 

Gets a string representing the data type of the specified column.

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

public:
virtual String^ GetDataTypeName(
	int ordinal
) override

Parameters

ordinal
Type: System::Int32

The zero-based column ordinal.

Return Value

Type: System::String^

A string representing the column's data type.

Exception Condition
ArgumentOutOfRangeException

The index passed was outside the range of 0 to FieldCount - 1.

InvalidOperationException

An attempt was made to read or access a column in a closed DataTableReader.

The GetDataTypeName method always returns the type of the underlying DataColumn instead of a provider-specific type.

The following console application displays a list of fields and their type names from a simple DataTable:

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

The Console window displays the following results:

ID: Int32
Name: String

.NET Framework
Available since 2.0
Return to top
Show:
© 2017 Microsoft