This documentation is archived and is not being maintained.

DataTable::CreateDataReader Method

Returns a DataTableReader corresponding to the data within this DataTable.

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

public:
DataTableReader^ CreateDataReader()

Return Value

Type: System.Data::DataTableReader
A DataTableReader containing one result set, corresponding to the source DataTable instance.

The following console application creates a DataTable instance. The example then passes the filled DataTable to a procedure that calls the CreateDataReader method, which iterates through the results contained within the DataTableReader.

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

The example displays the following output in the console window:

1 Mary

2 Andy

3 Peter

4 Russ

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: