日期:2014-05-19  浏览次数:20872 次

急问:所有设置都正确有的机器出错:使用 SqlConnection 时出错 Thunk.Security.Init()
ystem.NullReferenceException:   Object   reference   not   set   to   an   instance   of   an   object.
      at   LoadLibraryW(UInt16*   )
      at   System.EnterpriseServices.Thunk.Security.Init()
      at   System.EnterpriseServices.Thunk.Security.SuspendImpersonation()
      at   System.EnterpriseServices.Platform.Initialize()
      at   System.EnterpriseServices.ResourcePool..ctor(TransactionEndDelegate   cb)
      at   System.Data.SqlClient.ConnectionPool..ctor(DefaultPoolControl   ctrl)
      at   System.Data.SqlClient.PoolManager.FindOrCreatePool(DefaultPoolControl   ctrl,   IntPtr   SID)
      at   System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString   options,   Boolean&   isInTransaction)
      at   System.Data.SqlClient.SqlConnection.Open()
      at   WindowsApplication1.Form1.button2_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.ControlNativeWindow.OnMessage(Message&   m)
      at   System.Windows.Forms.ControlNativeWindow.WndProc(Message&   m)
      at   System.Windows.Forms.NativeWindow.Callback(IntPtr   hWnd,   Int32   msg,   IntPtr   wparam,   IntPtr   lparam)



------解决方案--------------------
机器上是否装了企业库?
------解决方案--------------------
好象是安全权限的问题
------解决方案--------------------
at System.EnterpriseServices.Thunk.Security.Init()方法中好像有个对象没有使用 new 方法