I am running:
- Windows 10 Home
- Oracle Database 11g Enterprise Edition 11.2.0.1 - 64 bit version
- Visual Studio Express 2013
I want to write a simple C# application to read data from the Oracle database and want to use ODP.NET. However, when running the program I'm getting an immediate Runtime Error.
I started a new Windows Forms project.
I linked service Oracle.DataAccess.dll in directory c:\app\Dave\product\11.2.0\dbhome_1\ODP.NET\bin\2.x\
My code is:
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace testapp_2
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
Code :
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
namespace testapp_2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
OracleConnection conn = new OracleConnection();
}
}
}
The error is:
Could not load file or assembly 'Oracle.DataAccess, Version=2.112.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. An attempt was made to load a program with an incorrect format.
When running in debug mode, the program halts at line:
Application.Run(new Form1());
I have used this in the past successfully with Visual Stdio Express 2008 and Oracle 10g under Windows XP and thought this would be very simple just like before, but apparently not.
Has anyone else encountered this error and hopefully have found a workaround for it? I would be most appreciative of any help or information.
Thank you very much!
-Dave.