title: Could not load file or assembly 'Oracle.DataAccess, Version=4.112.4.0, Culture=neutral, PublicKeyToken=89b483f429c47342'
body: <p>I have installed oracle <strong>11 g r 2</strong> in the server, and I downloaded <code>ODAC112040Xcopy_64bit</code> and installed the .net components.</p>
  
  <p>I copied <code>Oracle.DataAccess.dll</code> that exists in this location  <code>Oracle_Folder\odp.net\bin\4</code> to the <code>bin</code> folder inside my Visual Studio project</p>
  
  <p>When I executed my code, I got this exception: </p>
  
  <blockquote>
    <p>An unhandled exception of type 'System.BadImageFormatException' occurred in TestOracleConnection.exe</p>
    
    <p>Additional information: Could not load file or assembly 'Oracle.DataAccess, Version=4.112.4.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. An attempt was made to load a program with an incorrect format.</p>
  </blockquote>
  
  <p>My code is:</p>
  
  <pre><code>public string CallCardDetails(string CallCardNo)
  {
      //initialize
      using (DataSet ds = new DataSet())
      {
          //connect
          using (OracleConnection conn = new OracleConnection("User Id=oraDB;Password=ora;Data Source=CCT"))
          {
              // Oracle uses : for parameters, not @
              string query = "SELECT idcard from CallCardTable where idcard= :pCallCardNo";
  
              // Let the using block dispose of your OracleCommand
              using (OracleCommand cmd = new OracleCommand(query, conn))
              {
                  // Note: be careful with AddWithValue: if there's a mismatch between the .NET datatype of
                  // CallCardNo and the idcard column you could have an issue.  Cast the value you provide
                  // here to whatever is closest to your database type (String for VARCHAR2, DateTime for DATE, Decimal for NUMBER, etc.)
                  cmd.Parameters.Add(":pCallCardNo", CallCardNo);
                  conn.Open();
  
                  // Again, wrap disposables in a using or use try/catch/finally (using will dispose of things in case of exceptions too)
                  using (OracleDataAdapter dA = new OracleDataAdapter(cmd))
                  {
                      dA.Fill(ds);
  
                      return ds.GetXml();
                  }
              }
          }
      }
  }
  </code></pre>