我正在使用 Visual Studio 2008 Express Edition,并且正在尝试使用 Oracle.DataClient 开发一个小型应用程序。尝试连接到目标系统中的数据库时,出现上述错误。
我为 Oracle 10gR2 添加了对 Oracle ODP.net 提供程序的引用,并且在目标机器上我安装了 Oracle 10gR2 数据库的副本。尽管如此,我还是得到了错误。在发布之前,我在 SO 阅读了这篇文章,并且我已经安装了即时客户端,但错误仍然存在。下面是完整的错误堆栈。
************** Exception Text **************
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 Employees1.frmLogin.oralogin()
at Employees1.frmLogin.btnTest_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
API Data Conversion Assistant
Assembly Version: 0.0.0.1
Win32 Version: 0.0.0.1
CodeBase: file:///C:/Documents%20and%20Settings/3i/My%20Documents/My%20Dropbox/Sathya's%20dropbox/VisualStudio%20Releases/APIDataconversion/Application%20Files/API%20Data%20Conversion%20Assistant_0_0_0_3/API%20Data%20Conversion%20Assistant.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
Oracle.DataAccess
Assembly Version: 2.102.2.20
Win32 Version: 2.102.2.20
我在开发应用程序的机器上安装了 Oracle 11g,它在那里工作正常,但在目标机器上,我收到了这个错误。任何输入将不胜感激。
PS:上面提到的Oracle.DataClient.dll文件版本对应的是10gR2,不是11g。