会C# 操作 Fireword 嵌入版数据库的进!!!!!!!!!!!!
最近用C# 和 firebird 嵌入版做项目,C#连接服务器版的 firebird 跟连接其他数据库服务器没有什么区别,但是现在 是firebird嵌入版本,我用的是FirebirdSql.Data.FriebirdClinet 这个 Data Provider,
查询了一下手册:
Problem #1 - How to find fbembed.dll
The fbembed.dll is not a managed assembly, it's a classical DLL called using PInvoke (DllImport attribute). By default, the Firebird ADO.NET Provider is looking for the fbembed.dll in the default paths, which includes the system directory (e.g. C:\Windows\System32) but not the ASP.NET application bin directory. This is a problem when you don't have the access to the system directory - this is something that your hosting provider rarely allows you to.
The solution is to use the "clientlibrary" parameter in connection string and specify path to fbembed.dll.
但是我实验了,不行,提示无法加载dll,找不到指定的模块。
FbConnectionStringBuilder cs = new FbConnectionStringBuilder();
cs.ClientLibrary = @"E:\My Program\My Test\FireBird\Bird\Bird\bin\Debug\gds32.dll";
cs.Database = @"E:\My Program\My Test\FireBird\Bird\Bird\bin\Debug\BIRD_TEST.GBD";
cs.ServerType =FbServerType.Embedded;
cs.UserID = "sysdba";
cs.Password = "masterkey";
cs.Dialect = 3;
FbConnection cn = new FbConnection();
cn.ConnectionString = cs.ToString();
cn.Open();
string strSQL = "select * from t_student";
FbDataAdapter ad = new FbDataAdapter(strSQL, cn);
System.Data.DataSet ds = new System.Data.DataSet();
ad.Fill(ds);
cn.Close();
this.dataGridView1.DataSource = ds.Tables[0].DefaultView;
ds.Dispose();
请高手帮助解决一下,尤其用过c#和firebird 开发项目的高手,给我讲讲,我是第一次使用!