把datagrid上的数据复制到Clipboard 中,exe的smart Client ,在IE和.net框架中都设好了相应的权限和安全。在IE安全的信任站点把那个网站加进去,并且级别最低,并且在.net框架中也设了信任程序集,
现在用源代码调试,都是没问题的
直接运行的exe程序,始终都会报错:
报错的详细信息如下:
有关调用实时 (JIT) 调试而不是此对话框的详细信息,
请参阅此消息的结尾。************** 异常文本 **************
System.Threading.ThreadStateException: 要进行 OLE 调用,必须将当前线程设置为单线程单元 (STA) 模式。请确保您的 Main 函数在其上已标有 STAThreadAttribute。
   at System.Windows.Forms.Clipboard.SetDataObject(Object data, Boolean copy)
   at DPSControl.UserCheckControl.DataSetToClipBoard(DataTable dt)
   at DPSControl.UserCheckControl.toolBar1_ButtonClick(Object sender, ToolBarButtonClickEventArgs e)
   at System.Windows.Forms.ToolBar.OnButtonClick(ToolBarButtonClickEventArgs e)
   at System.Windows.Forms.ToolBar.WmReflectCommand(Message& m)
   at System.Windows.Forms.ToolBar.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)************** JIT 调试 **************
若要启用实时 (JIT) 调试,此
应用程序或计算机的配置文件 (machine.config) 的 
 system.windows.forms 节中必须设置 jitDebugging 值。
编译应用程序时还必须启用
调试。启用 JIT 调试后,任何未处理的异常
将被发送到此计算机上注册的 JIT 调试器,
而不是由此对话框处理。