出于某种原因,我无法使用C#/ .NET在Windows上使用嵌入式firebird sql。这是我的代码:
string BuildConnectionString()
{
FbConnectionStringBuilder builder = new FbConnectionStringBuilder();
builder.DataSource = "localhost";
builder.UserID = "SYSDBA";
builder.Password = "masterkey";
builder.Database = "database.fdb";
builder.ServerType = FbServerType.Embedded;
return builder.ConnectionString;
}
private void OnConnectClicked(object sender, EventArgs e)
{
string cString = BuildConnectionString();
FbConnection.CreateDatabase( cString );
FbConnection connection = new FbConnection( cString );
connection.Open();
//CreateTable();
//FillListView();
connection.Close();
}
当我调用FbConnection.CreateDatabase时,我得到以下异常:
尝试加载格式不正确的程序。 (HRESULT异常:0x8007000B)
我对SQL和Firebird一般都很新,所以我不确定如何解决这个问题。任何人吗?
答案 0 :(得分:2)
我弄明白了这个问题。我使用64位服务器DLL并将我的.NET应用程序编译为32位。切换到32位服务器DLL修复它。