使用ADODB记录集 [英] Working with ADODB recordset

查看:54
本文介绍了使用ADODB记录集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用VS2010.需要提取 ADODB记录集并将其转换为 DataTable .ASP.NET中是否有任何扩展方法或库可用于将 ADODB记录集转换为Datatable.

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.

我可以理解使用 OleDataAdapter 我们可以实现它.但是我很想知道ASP.net中是否有任何实用程序,以便我可以使用它.

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.

推荐答案

这是帮助您将 ADODB Recordset 转换为 DataTable 的简单方法之一.>

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;
  }

确保您已引用Microsoft ActiveX Data Objects 2.0库或>

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

注意:我尚未测试代码.

Note : I haven't tested the code.

这篇关于使用ADODB记录集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆