Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/290.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#IDbConnection FbConnection失败。索引超出范围_C#_Connection_Firebird_Interbase - Fatal编程技术网

C#IDbConnection FbConnection失败。索引超出范围

C#IDbConnection FbConnection失败。索引超出范围,c#,connection,firebird,interbase,C#,Connection,Firebird,Interbase,我想使用c#和Firebird客户端连接到本地网络中的Interbase服务器。我尝试了很多不同的例子,但都失败了。最后我找到了这个页面,所以我的代码基于这个示例 调用此函数时,它返回错误: Index is out of Range... (via MessageBox.Show(e.Message);) 我知道,整个代码并不干净,但我想发布完整的类,稍后我会修复其他错误 使用系统; 使用系统数据; 使用System.Collections.Generic; 使用System.Linq; 使

我想使用c#和Firebird客户端连接到本地网络中的Interbase服务器。我尝试了很多不同的例子,但都失败了。最后我找到了这个页面,所以我的代码基于这个示例

调用此函数时,它返回错误:

Index is out of Range... (via MessageBox.Show(e.Message);)
我知道,整个代码并不干净,但我想发布完整的类,稍后我会修复其他错误

使用系统;
使用系统数据;
使用System.Collections.Generic;
使用System.Linq;
使用System.Threading.Tasks;
使用系统图;
使用系统文本;
使用System.Windows.Forms;
使用系统配置;
使用FirebirdSql.Data.FirebirdClient;
名称空间IBcon
{
类间数据库
{
公共DataGridView testbla()
{
字符串连接字符串=
“Database=C:\\data\\DB.GDB;”+
“User=SYSDBA;”+“Password=masterkey;”+
“方言=3;”+“服务器=192.168.1.15”;
IDbConnection dbcon=新建(connectionString);
DataGridView dgv=新建DataGridView();
尝试
{

dbcon.Open();
FirebirdClient
不适用于InterBase。它适用于Firebird。您需要为InterBase使用ADO.NET提供程序。

据我所知,FirebirdSql.Data.FirebirdClient仅适用于Firebird,不适用于InterBase。我还建议您发布整个stacktrace,而不仅仅是异常消息。使用fdb作为DB.Doe的扩展这有什么帮助?@magicandre1981扩展不重要(如果是错误的数据库名称,则会出现不同的错误)。仍然有很多公司使用
gdb
作为Firebird数据库的扩展。好的,首先,谢谢大家。我安装了ADO.NET并尝试了一个代码(.NET 4.5/c#/VS2012)如下所示:但每次我启动程序时,它都会因错误而崩溃,即找不到GDS32.DLL。我在Win7 32位系统上安装了ADO,并将DLL添加到我的引用中。看起来您的应用程序附近没有
GDS32.DLL
(随InterBase一起提供)(当要求加载时,系统会在其中查找DLL)。我安装了IBConsole,它需要GDS32.DLL。DLL文件存在于C:\Windows\System32目录中。我搜索了很多网站,发现很多网站都说我必须注册DLL文件(regsvr32 | | | regsvr/I)。每次我尝试此操作时,都会出现一个错误(模块无法加载…dllregisterserver)。我很抱歉问这么简单的问题。我试图用自己的方式(谷歌等)修复此错误,但我尝试的一切都失败了。你不必注册它。只要在应用程序尝试从(默认路径、预定义路径等)加载时放置它即可。