如何创建给予的DbCommand或的DbConnection一个DbDataAdapter的? [英] How to create a DbDataAdapter given a DbCommand or DbConnection?
问题描述
我想创建一个与任何数据提供工作的一个数据访问层。
I want to create a data access layer that works with any data provider.
我知道它可以创建一个的DbCommand
使用可用的连接上的工厂方法。
I know it's possible to create a DbCommand
using the factory method available on the connection.
objDbCon.CreateCommand();
不过,我找不到任何东西来创建一个 DbDataAdapter的
。这是在ADO.NET中的错误还是什么?
However, I could not find anything to create a DbDataAdapter
. Is this is a bug in ADO.NET or what?
推荐答案
<一个href="http://msdn.microsoft.com/en-us/library/system.data.common.dbproviderfactory.createdataadapter.aspx">DbProviderFactory.CreateDataAdapter *
你也可以通过<一个所有注册DbProviders href="http://msdn.microsoft.com/en-us/library/system.data.common.dbproviderfactories.getfactoryclasses.aspx">DbProviderFactories类。
*我认为这是一个错误的地方,这个方法。
*I think this is a wrong place for this method.
这篇关于如何创建给予的DbCommand或的DbConnection一个DbDataAdapter的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!