tags:

views:

37

answers:

1

For some reason, I can't get embedded firebird sql to work on Windows using C#/.NET. Here's my code:

    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();
    }

When I call FbConnection.CreateDatabase, I get the following exception:

An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

I'm very new to SQL and Firebird in general, so I'm not sure how to resolve this issue. Anyone?

A: 

I figured out the problem. I was using the 64-bit server DLLs and compiling my .NET app as 32-bit. Switching to the 32-bit server DLLs fixed it.

Bob