用于OPD.NET的web.config中的Asp.net连接字符串

时间:2014-06-28 16:42:33

标签: c# asp.net oracle oracle11g

我有oracle数据库。我在Visual Studio 2012中安装了oracle client.Added refrence of Oracle.DataAccess并使用了两个名称空间

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" />
      </connectionStrings>

but when I run my application i get following error

ystem.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

请指导我如何解决这个问题。为什么上面的错误显示

0 个答案:

没有答案