Convert a DataReader to DataTable in ASP.NET using C# or VB.net :

While we are working with datareader when you want to bind data to a control which
gets binded to a datatable only, that time you can convert that datareader to Datatable.
So that you can bind that datatable to the Gridview which can be performed as follows.

To Convert a DataReader to DataTable you need to follow following steps:

Then you can execute that Procedure using Executereader and load that datareader
into Datatable using Load method of the DataTable.This method is useful when you
need to quickly create a DataTable, without using a DataAdapter.

Dim dr As SqlDataReader = cmd.ExecuteReader()
Dim dt As DataTable = New DataTable()
dt.Load(dr)
Note: If you want DataReader back from DataTable we useDataTable.CreateDataReader()