Exception thrown when creating database

Posted by Bob on Stack Overflow See other posts from Stack Overflow or by Bob
Published on 2010-04-20T14:50:38Z Indexed on 2010/04/20 14:53 UTC
Read the original article Hit count: 155

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about c#

Related posts about firebird