I'm using FireBird embedded in my .net application.The fellow is my connection:
the code is:
public class ImDb{
private static FbConnection _fbConnection;
public static FbConnection IMManagerConnection() {
var fbConnStringBuilder = new FbConnectionStringBuilder();
fbConnStringBuilder.ServerType = FbServerType.Embedded;
fbConnStringBuilder.UserID = "sysdba";
fbConnStringBuilder.Password = "masterkey";
//fbConnStringBuilder.ClientLibrary = @"fbembed.dll";
fbConnStringBuilder.Database = @"IMMANAGER.FDB";
_fbConnection = new FbConnection(fbConnStringBuilder.ConnectionString);
return _fbConnection;
}
}
this is my test case:
the code is:
[Test]
public void SimSymbolTest(){
FbConnection fbc=IMManager.Common.ImDb.IMManagerConnection();
fbc.Open();
Console.WriteLine("The Server Version is :" + fbc.ServerVersion);
Console.WriteLine("The database is :" + fbc.Database);
Console.WriteLine("The DataSource is :" + fbc.DataSource);
Console.WriteLine("The Version Number is: " + fbc.ServerVersionNumber);
fbc.Close();
}
In my application,it's error!!report Don't load fbembed.dll
the code is:
private DataTable ExeQuery(string sqlString){
DataSet ds = new DataSet();
FbConnection fbc = ImDb.IMManagerConnection();
try {
fbc.Open();
FbTransaction fbt = fbc.BeginTransaction();
FbCommand fbcmd = new FbCommand(sqlString, fbc, fbt);
FbDataAdapter fbda = new FbDataAdapter(fbcmd);
fbda.Fill(ds);
fbt.Commit();
} catch (Exception ex) {
MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
} finally {
fbc.Close();
}
return ds.Tables[0];
}
And this's my directory:
help me,please!Thanks in advance!
And then I modify the code of connection,add the ClientLibrary's value:
And the Test case is running OK!
But the in application ,the Error is occured again.