what I learn is what u c

Recordset to Datatable (Asp.Net)

leave a comment »

If you are migrating your application from Asp to Asp.Net, Recordsets to Datatable will be key issue.

 If you want to utilize the power of Datagrid or any controls then DataTable and DataSets is the way to go.

 Fortunately converting Recordset to DataTable or DataSet is very easy.


1 . Create an OleDb DataAdapter

2. Create a DataTable Object

3. Fill the Adapter with Recordset values.

4. Add DataTable to DataSet (if needed)

Now the coding part

Dim MyAdapter As OleDbDataAdapter = New OleDbDataAdapter()

Dim <strong>dtRSTable</strong> As System.Data.DataTable = New DataTable()

MyAdapter.Fill(<strong>dtRSTable</strong>, Rs)

Now <strong>dtRSTable</strong> is ready.

This dtRSTable can be directly referenced in a datagrid or added to DataSet

dgSampleGrid.datasource = dtRSTable.Defaultview



'Adding DataTable to DataSet

dim dsTable as New DataSet


Written by gchandra

January 19, 2007 at 1:17 am

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: