会C# 操作 Fireword 嵌入版数据库的进!!!!!!!!!!!!

love_study 2009-04-09 09:44:12
最近用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 开发项目的高手,给我讲讲,我是第一次使用!
...全文
165 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

111,126

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧