user2535931
user2535931

Reputation:

Working with ADODB recordset

I am using VS 2010. The requirement to pull the ADODB recordset and convert them into DataTable. Is there any extension method or library available in ASP.NET to convert ADODB recordset to Datatable.

I can understand using OleDataAdapter we can achieve it. But I am curious to know is there any utility available in ASP.net so that I can make use of it.

Upvotes: 1

Views: 2291

Answers (1)

user2488066
user2488066

Reputation:

This is one of the simple approaches which helps you to convert ADODB Recordset to DataTable.

 public static DataTable ADODBRSetToDataTable(this ADODB.Recordset adodbRecordSet)
  {
                OleDbDataAdapter dataAdapter = new OleDbDataAdapter();
                DataTable dt = new DataTable();
                dataAdapter.Fill(dt,adodbRecordSet);
                return dt;
  }

Ensure you have made a reference to Microsoft ActiveX Data Objects 2.0 library or >

Note : I haven't tested the code.

Upvotes: 1

Related Questions