vs2008连接Oracle10G出错
问题是这样的,我新建一个winform用同样的连接字符串,没有报错,但在我的这个项目就会报错,十会不解
这是我们连接字符串
MessageBox.Show("1111");
string zzzz = @"Data Source=test;Persist Security Info=True;User ID=yp;Password=yp;Unicode=True";
using (OracleConnection conn = new OracleConnection(zzzz))
{
conn.Open();;
MessageBox.Show("sdfsdf");
}
这应该是没问题的,新建项目用这个是没有报错的。就是不明白了OracleClient我也引用了,下南是报错信息,求高手解答
未处理 System.TypeInitializationException
Message="“System.Data.OracleClient.OracleConnection”的类型初始值设定项引发异常。"
Source="System.Data.OracleClient"
TypeName="System.Data.OracleClient.OracleConnection"
StackTrace:
在 System.Data.OracleClient.OracleConnection..ctor(String connectionString)
在 opdoctor.Form1.button1_Click(Object sender, EventArgs e) 位置 d:\我的文档\Visual Studio 2008\Projects\opdoctor\opdoctor\Form1.cs:行号 23
在 System.Windows.Forms.Control.OnClick(EventArgs e)
在 System.Windows.Forms.Button.OnClick(EventArgs e)
在 System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
在 System.Windows.Forms.Control.WndProc(Message& m)
在 System.Windows.Forms.ButtonBase.WndProc(Message& m)
在 System.Windows.Forms.Button.WndProc(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
在 System.Windows.Forms.Application.Run(Form mainForm)
在 opdoctor.Program.Main() 位置 d:\我的文档\Visual Studio 2008\Projects\opdoctor\opdoctor\Program.cs:行号 17
在 System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
在 System.Threading.ThreadHelper.ThreadStart()
InnerException: System.TypeInitializationException
Message="“System.Data.OracleClient.OracleConnectionFactory”的类型初始值设定项引发异常。"
Source="System.Data.OracleClient"
TypeName="System.Data.OracleClient.OracleConnectionFactory"
StackTrace:
在 System.Data.OracleClient.OracleConnection..cctor()
InnerException: System.TypeInitializationException
Message="“System.Data.OracleClient.OraclePerformanceCounters”的类型初始值设定项引发异常。"
Source="System.Data.OracleClient"
TypeName="System.Data.OracleClient.OraclePerformanceCounters"
StackTrace:
在 System.Data.OracleClient.OracleConnectionFactory..ctor()
在 System.Data.OracleClient.OracleConnectionFactory..cctor()
InnerException: System.Configuration.ConfigurationErrorsException
Message="配置系统未能初始化"
Source="System.Configuration"
BareMessage="配置系统未能初始化"
Line=0
StackTrace:
在 System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)
在 System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
在 System.Configuration.ConfigurationManager.GetSection(String sectionName)
在 System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName)
在 System.Diagnostics.DiagnosticsConfiguration.GetConfigSection()
在 System.Diagnostics.DiagnosticsConfiguration.Initialize()
在 System.Diagnostics.Switch.InitializeConfigSettings()
在 System.Diagnostics.Switch.InitializeWithStatus()
在 System.Diagnostics.Switch.get_SwitchSetting()
在 System.Diagnostics.TraceSwitch.get_Level()
在 System.Data.ProviderBase.DbConnectionPoolCounters..ctor(String categoryName, String categoryHelp)
在 System.Data.OracleClient.OraclePerformanceCounters..ctor()
在 System.Data.OracleClient.OraclePerformanceCounters..cctor()
InnerException: System.Configuration.ConfigurationErrorsException
Message="无法识别的配置节 add。 (d:\\我的文档\\Visual Studio 2008\\Projects\\opdoctor\\opdoctor\\bin\\Debug\\opdoctor.vshost.exe.Config line 3)"
Source="System.Configuration"
BareMessage="无法识别的配置节 add。"
Filename="d:\\我的文档\\Visual Studio 2008\\Projects\\opdoctor\\opdoctor\\bin\\Debug\\opdoctor.vshost.exe.Config"
Line=3
StackTrace:
在 System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
在 System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors)
在 System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
在 System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)
InnerException: