Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using ODP.NET .I have oracle database.I have installed oracle client.Added refrence of Oracle.DataAccess in visual studio 2012 and use two name spaces

using Oracle.DataAccess.Types;
using Oracle.DataAccess.Client;
and using following connection string in web.config

<connectionstrings>
<add name="Oracleconnect" connectionstring="Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS= (PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl.234.9.4)));User ID=hr;password=hr">
providerName="Oracle.DataAccess.Client" >

but when I run my application i get following error
System.TypeInitializationException: The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception. ---> Oracle.DataAccess.Client.OracleException: The provider is not compatible with the version of Oracle client at Oracle.DataAccess.Client.OracleInit.Initialize() at Oracle.DataAccess.Client.OracleConnection..cctor() --- End of inner exception stack trace --- at Oracle.DataAccess.Client.OracleConnection..ctor(String connectionString) at SchoolsManagementSystem.DAL.GetConnection() in d:\c#\SchoolsManagementSystem\SchoolsManagementSystem\App_Code\DAL.cs:line 20 at SchoolsManagementSystem.DAL.AunthicateUser(String username, String password) in d:\c#\SchoolsManagementSystem\SchoolsManagementSystem\App_Code\DAL.cs:line 24 at SchoolsManagementSystem.Login.btnLogin_Click(Object sender, EventArgs e) in d:\c#\SchoolsManagementSystem\SchoolsManagementSystem\Login.aspx.cs:line 46
Posted
Updated 28-Jun-14 9:08am
v3

1 solution

Try to put all your DLLs in the same folder of your C# Executable.
These may include:
oci.dll
Oracle.DataAccess.dll
oraociicus11.dll
OraOps11w.dll
orannzsbb11.dll
oraocci11.dll
ociw32.dll

Check this[^] useful link for more information.
 
Share this answer
 
Comments
Sheikh Waqas Ali 28-Jun-14 16:31pm    
I have installed ODP.NET thruogh ODAC112040Xcopy_32bit and then click install.bat and configure.bat and then added following refrence of Oracle.DataAcess.dll in Visual studio
D:\tutorials\oracle\ODAC112040Xcopy_32bit\odp.net4\odp.net\bin\4 Oracle.DataAccess.dll

I also installed oracle client runtime

D:\app\hp\product\11.2.0\client_1\ODP.NET\bin\2.x Oracle.DataAccess
and in it also have Oracle.DataAcess which refrence I used in oracle client
Sheikh Waqas Ali 28-Jun-14 16:32pm    
Oracle.DataAccess.dll
oraociicus11.dll
OraOps11w.dll
orannzsbb11.dll
oraocci11.dll
ociw32.dll

where is the location of above DLLs and guide me about c# Execute able folder

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900