火鸟与Visual Studio 2010无法找到数据提供程序 [英] Firebird & Visual Studio 2010 Failed to find Data Provider

查看:149
本文介绍了火鸟与Visual Studio 2010无法找到数据提供程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Windows 7 64bit.我正在尝试在VS 2010中使用Firebird.

I have Windows 7 64bit. I am trying to use Firebird with VS 2010.

我收到以下错误:

无法找到或加载已注册的.Net Framework数据提供程序.

我已经完成了以下

  1. 安装了"NETProvider-2.6.5.msi"
  2. 提取了"FirebirdDDEXProvider-2.0.5.zip"

我将.dll的文件从DDEX zip文件复制到了目录中 C:\ Program Files(x86)\ FirebirdClient ,其内容为:

I copied the .dll's from the DDEX zip file to the directory C:\Program Files (x86)\FirebirdClient The contents of which are:

FirebirdSql.Data.FirebirdClient.dll
FirebirdSql.Data.UnitTests.dll
FirebirdSql.VisualStudio.DataTools.dll
FirebirdSql.VisualStudio.DataToolsUI.dll

我编辑了DDEX中的2个reg文件,将%path%"替换为" C:\ Program Files(x86)\ FirebirdClient "

I edited the 2 reg files from the DDEX, replacing "%path%" with "C:\Program Files (x86)\FirebirdClient"

从目录"C:\ Program Files(x86)\ Microsoft SDKs \ Windows \ v7.0A \ Bin \ NETFX 4.0 Tools"中,我已经运行了Gacutil,如下所示:

From the directory "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools" I have run the Gacutil, as follows

cd "C:\Program Files (x86)\FirebirdClient"
"C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\gacutil.exe" /i FirebirdSql.VisualStudio.DataTools.dll

"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\gacutil.exe" /i FirebirdSql.Data.FirebirdClient.dll

我不能使用另一个Gacutil,因为它说它是为以前的版本构建的.

I could not use the other Gacutil, as it said it was built for a previous version.

我也跑过

"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\gacutil.exe" /l Firebirdsql.data.firebirdclient

哪个给了我

The Global Assembly Cache contains the following assemblies:
Firebirdsql.data.firebirdclient, Version=2.6.5.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c, processorArchitecture=MSIL

从目录 C:\ Windows \ Microsoft.NET ,我修改了以下4个文件:

From the directory C:\Windows\Microsoft.NET I have modified the following 4 files:

\Framework\v4.0.30319\Config\machine.config
\Framework\v2.0.50727\Config\machine.config

\Framework64\v2.0.50727\Config\machine.config
\Framework64\v4.0.30319\Config\machine.config

在每个文件中,我添加了以下2个条目

In each of these files, I have added the following 2 entries

<configuration>
    <configSections>
        <section name="FirebirdSql.Data.FirebirdClient" type="System.Data.Common.DbProviderConfigurationHandler, System.Data, Version=2.6.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    </configSections>
</configuration>

<system.data>
    <DbProviderFactories>
       <add name="Firebird Client Data Provider" invariant="FirebirdSql.Data.FirebirdClient" description=".Net Framework Data Provider for Firebird" type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient, Version=2.6.5.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c" />
    </DbProviderFactories>
</system.data>

所有这些之后,我仍然无法使Firebird与Visual Studio一起工作.我可以查看数据库&服务器资源管理器中创建表,但是我无法添加数据源,在完成步骤时,它会显示错误:

After all of this, I still can't get firebird working withing Visual studio. I can view the database & tables from within the Server explorer, however I can't add a datasource, at the finish step, it gives an error:

"创建新数据源时发生错误: 无法获取"WinFormsApp.DataSet1"的类型信息.

"An error occurred while creating the new data source: Could not get type information for "WinFormsApp.DataSet1".

作为一个更好的示例,使用DbProviderFactory,Firebird是第5个索引,我运行以下代码:

As a better example, Using the DbProviderFactory, Firebird is the 5th index, I run the following code:

try
   {
      DataTable dt = DbProviderFactories.GetFactoryClasses();
      // Use this for loop to see what row holds FirebirdClient
      for (int i = 0; i < dt.Rows.Count; i++)
          Console.WriteLine("{0}: {1}", i.ToString(), dt.Rows[i][2].ToString());

      // For me, FirebirdClient is at row 5
      DbProviderFactory dataFactory = DbProviderFactories.GetFactory(dt.Rows[5]);

出现以下异常:

无法找到或加载已注册的.Net Framework数据提供程序.

例外:

System.Configuration.ConfigurationErrorsException was caught
  Message=Failed to find or load the registered .Net Framework Data Provider.
  Source=System.Data
  BareMessage=Failed to find or load the registered .Net Framework Data Provider.
  Line=0
  StackTrace:
       at System.Data.Common.DbProviderFactories.GetFactory(DataRow providerRow)
       at Forms.TestForm.TestConn() in C:\Data\Projects\Dev\FirebirdTest\Forms\TestForm.cs:line 113
  InnerException: null

任何人都可以提供帮助.

Can anyone please assist.

推荐答案

machine.config中的这一行:

This line in the machine.config:

<configSections>
    <section name="FirebirdSql.Data.FirebirdClient" type="System.Data.Common.DbProviderConfigurationHandler, System.Data, Version=2.6.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>

应如下所示:

<configSections>
    <section name="firebirdsql.data.firebirdclient" type="System.Data.Common.DbProviderConfigurationHandler, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>

请注意,版本是不同的,它应该是运行时版本,而不是firebird客户端的版本.我也认为您只需要编辑machine.config的32位版本,因为VS是32位应用程序.

Note that the version is different, it's supposed to be the runtime versin and not the version of the firebird client. Also I believe that you need only edit the 32bit version of the machine.config since VS is a 32 bit application.

这篇关于火鸟与Visual Studio 2010无法找到数据提供程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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