0

Trying to use Firebird db with c# win forms. While trying to open connection its showing me the following error.

An unhandled exception of type 'System.BadImageFormatException' occurred in FirebirdSql.Data.FirebirdClient.dll

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

my connection string is

        <add name="dbConFirebirdSQL" connectionString="User Id=locuser_r;Password=locpassword_r;Database=LOCDBOES_R.FDB;ServerType=Embedded;" />


string sql5 = "sql query here";
                                try
                                {
                                    FbConnection con95 = new FbConnection(connectionString);
                                    con95.Open();
                                    FbCommand cmd95 = new FbCommand(sql5, con95);
                                    cmd95.Parameters.Add("@t_id", FbDbType.Integer).Value = tid;

                                    cmd95.CommandType = CommandType.Text;
                                    cmd95.ExecuteNonQuery();
                                }
                                catch (FbException ex)
                                {
                                    MessageBox.Show("4--" + ex.Message);
                                }

Please advise what could be wrong.

gomesh munda
  • 838
  • 2
  • 14
  • 32

1 Answers1

0

I had the same problem, and I fixed it by setting "Platform target" to "x64" instead of "Any CPU" or "x86" in the project properties:

enter image description here

ascpixi
  • 529
  • 4
  • 13