gpt4 book ai didi

ado.net - 缺少 DbProviderFactories.GetFactory 方法 (DbConnection)

转载 作者:行者123 更新时间:2023-12-03 17:52:25 29 4
gpt4 key购买 nike

根据 MSDN .NET 4 中有 GetFactory(DbConnection) 的重载。但是,我无法调用它 - 在编译时失败说:

error BC30518: Overload resolution failed because no accessible 'GetFactory' can be called with these arguments:
'Public Shared Function GetFactory(providerRow As System.Data.DataRow) As System.Data.Common.DbProviderFactory': Value of type 'System.Data.Common.DbConnection' cannot be converted to 'System.Data.DataRow'.
'Public Shared Function GetFactory(providerInvariantName As String) As System.Data.Common.DbProviderFactory': Value of type 'System.Data.Common.DbConnection' cannot be converted to 'String'.

我的 .NET FW 有问题还是文档中的错字?

最佳答案

您可以使用以下解决方案调用“GetFactory”方法:
https://msdn.microsoft.com/en-us/library/dd0w4a2z%28v=vs.110%29.aspx

DbProviderFactory factory =
DbProviderFactories.GetFactory(providerName);

关于ado.net - 缺少 DbProviderFactories.GetFactory 方法 (DbConnection),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17811102/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com