Monday 7 January 2008

convert datareader to datatable

Dim objSQLdatareader As SqlClient.SqlDataReader = .ExecuteReader()

Dim dt As New DataTable
dt.Load(objSQLdatareader)

now datatable contains all data from datareader

we can assign datatable to datagrid, gridview datalist etc. as below

gridview.DataSource = dt
gridview1.DataBind()

No comments: