打开oracle链接时 尝试读取或写入受保护的内存

云想慕尘 2010-03-13 12:30:09
// 声明一个数据库连接对象
myConn = new OracleConnection( this.connectString );

try
{
myConn.Open();//此处报异常
}

下面是异常信息:

未处理 System.AccessViolationException
Message="尝试读取或写入受保护的内存。这通常指示其他内存已损坏。"
Source="System.Data.OracleClient"
StackTrace:
在 System.Data.Common.UnsafeNativeMethods.OCIServerAttach(OciHandle srvhp, OciHandle errhp, Byte[] dblink, Int32 dblink_len, MODE mode)
在 System.Data.OracleClient.TracedNativeMethods.OCIServerAttach(OciHandle srvhp, OciHandle errhp, String dblink, Int32 dblink_len, MODE mode)
在 System.Data.OracleClient.OracleInternalConnection.OpenOnLocalTransaction(String userName, String password, String serverName, Boolean integratedSecurity, Boolean unicode, Boolean omitOracleConnectionName)
在 System.Data.OracleClient.OracleInternalConnection..ctor(OracleConnectionString connectionOptions)
在 System.Data.OracleClient.OracleConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
在 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
在 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
在 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
在 System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
在 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
在 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
在 System.Data.OracleClient.OracleConnection.Open()
在 ImgCompress.OracleExecutive.ExecuteGetreader(ISql sql) 位置 C:\Documents and Settings\Administrator\桌面\图片压缩\ImgCompress\ImgCompress\OracleExecutive.cs:行号 408
在 ImgCompress.ImgDal.FindByPage(Int32 pageSize, Int32 pageIndex) 位置 C:\Documents and Settings\Administrator\桌面\图片压缩\ImgCompress\ImgCompress\ImgDal.cs:行号 48
在 ImgCompress.MainForm.btnCompress_Click(Object sender, EventArgs e) 位置 C:\Documents and Settings\Administrator\桌面\图片压缩\ImgCompress\ImgCompress\MainForm.cs:行号 103
在 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)
在 ImgCompress.Program.Main() 位置 C:\Documents and Settings\Administrator\桌面\图片压缩\ImgCompress\ImgCompress\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()
...全文
422 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
辰爸 2012-09-17
  • 打赏
  • 举报
回复
同问,我也出现这个问题了。
猴头 2012-05-21
  • 打赏
  • 举报
回复
猛一看还以为是我的提问帖字呢,和我的问题一样,不知道怎么解决
盜令玊 2011-01-17
  • 打赏
  • 举报
回复
我也遇到同样的问题 是.Net自带的OracleClient组件的问题 还是程序写的不对? 希望高人解答
xray2005 2010-03-13
  • 打赏
  • 举报
回复
你是你调用了什么C/C++的底层dll库?

如果是纯的.net托管程序,是不会这样的异常的.
云想慕尘 2010-03-13
  • 打赏
  • 举报
回复
自己顶起

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧