C# Console Application getting 'Oracle.DataAccess.Client.OracleConnection' exception

I am getting this Oracle connection exception.  The Oracle connection properties are correct, as I can use the same credentials to connect via TOAD or SQLDeveloper.

Is there any other dll's or anything else I need to remove this error?

I am using Visual Studio 2010 C# and Oracle 10g.

Thank You

Error Message Below:
"An unhandled exception of type 'System.TypeInitializationException' occurred in ExecuteQueryToXml.exe

Additional information: The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception."
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
Oracle client is the first thing to look at in regards to 32vs64 bit compiling.
Unless you have more detailed error messages, it will be difficult to tack this one.
käµfm³d 👽Commented:
See if there is anything in the Inner Exception property of that exception. If you got the standard exception window popup, then there is a "View Detail" link on the lower left of that window with which you can inspect the Inner Exception.
MachinegunnerAuthor Commented:
Thanks for the replies.

It is "bombing" on the line below:
OracleConnection connection = new OracleConnection(connectionStr);

The messagebox comes up with the title - "Microsoft Visual Studio"
and then the vague error message and then 3 buttons below that are:
"Break", "Continue" and "Ignore".  The Ignore button is grayed out.

Sorry, there is no "View Detail" link to access and the vertical scrollbar is
grayed out as well, as if you could or try to see if anymore info is provided.

When I click the Break button, I can see the Inner Exception message then,
from the local variables;

Inner Exception "The provider is not compatible with the version of Oracle client"
käµfm³d 👽Commented:
The provider is not compatible with the version of Oracle client
There you go:  You have either the wrong client installed, or you installed the wrong version of ODAC. Make sure you have downloaded the correct version of each.

Since it works in TOAD, your client is most likely fine. Make sure the version of ODAC that you downloaded works with that client.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MachinegunnerAuthor Commented:
I went ahead and downloaded this:



I installed it and then tried running the console app or debugging it and it opened the Oracle connection!  So all is good now.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.