已有56人关注
编译《C#开发典型模块大全》一书中第三章中项目源码时出现错误
发表在C#图书答疑 2010-06-09
是否精华
版块置顶:
老师:
您好!
我在编译《C#开发典型模块大全》一书中第三章中项目源码时出现以下错误信息:
第一、警告 方法“Word._Document.Close(ref object, ref object, ref object)”和非方法“Word.DocumentEvents2_Event.Close”之间存在二义性。将使用方法组。
第二、编译运行到
private void frmMain_Load(object sender, EventArgs e)
        {
            //加载所有的服务器名称
            getSQLServer();
            cbbSqlServerName.SelectedIndex = 0;

        }
        private void getSQLServer()
        {
            SQLDMO.Application SQLServer = new SQLDMO.Application();
            SQLDMO.NameList strServerList = SQLServer.ListAvailableSQLServers();不再运行,并弹出排错提示,排错提示的详细信息如下:
未处理 System.Runtime.InteropServices.COMException
  Message="[SQL-DMO]代码执行异常错误: EXCEPTION_ACCESS_VIOLATION"
  Source="Microsoft SQL-DMO"
  ErrorCode=-2147221499
  StackTrace:
       在 SQLDMO.ApplicationClass.ListAvailableSQLServers()
       在 SQL_Distill.frmMain.getSQLServer() 位置 E:\软件开发\范例\03\SQL-Distill\SQL-Distill\frmMain.cs:行号 33
       在 SQL_Distill.frmMain.frmMain_Load(Object sender, EventArgs e) 位置 E:\软件开发\范例\03\SQL-Distill\SQL-Distill\frmMain.cs:行号 26
       在 System.Windows.Forms.Form.OnLoad(EventArgs e)
       在 System.Windows.Forms.Form.OnCreateControl()
       在 System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       在 System.Windows.Forms.Control.CreateControl()
       在 System.Windows.Forms.Control.WmShowWindow(Message& m)
       在 System.Windows.Forms.Control.WndProc(Message& m)
       在 System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       在 System.Windows.Forms.ContainerControl.WndProc(Message& m)
       在 System.Windows.Forms.Form.WmShowWindow(Message& m)
       在 System.Windows.Forms.Form.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.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
       在 System.Windows.Forms.Control.SetVisibleCore(Boolean value)
       在 System.Windows.Forms.Form.SetVisibleCore(Boolean value)
       在 System.Windows.Forms.Control.set_Visible(Boolean value)
       在 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)
       在 SQL_Distill.Program.Main() 位置 E:\软件开发\范例\03\SQL-Distill\SQL-Distill\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: 请教如何排除?
分享到:
精彩评论 3
满园春色关不住
学分:0 LV1
TA的每日心情
努力自律
2023-11-19 09:49:04
2010-06-09
沙发
读者朋友:
    你好,对于您提出的问题,见意采用如下方法解决。
窗体Load事件中代码:
getSQLServer()
此方法加载所有的服务器名称,这个方法是可有可无的,如果将这一句注释掉不会影响后面程序的运行,当然,异常也是在此方法中出现的,如果想正确的执行此方法,那么要打SQL2000数据库的SP4补丁。
v-k
学分:0 LV1
TA的每日心情
开开心心学习中。。。。
2023-06-23 14:03:00
2010-06-10
板凳
老师,你好!我的配置情况,操作系统是XP、VS2008、SQL Server2008,应该没有问题吧,但就出现上述错误。请指教。谢谢。
满园春色关不住
学分:0 LV1
TA的每日心情
努力自律
2023-11-19 09:49:04
2010-06-11
地板
读者朋友:
    你好,程序在SQL2005下运行是没有问题的,如果条件允许请你在SQL2005试一下,对于您求知的心情,我们是很支持也很赞扬的,感谢你对明日图书的支持。
首页上一页 1 下一页尾页 3 条记录 1/1页
手机同步功能介绍
友情提示:以下图书配套资源能够实现手机同步功能
明日微信公众号
明日之星 明日之星编程特训营
客服热线(每日9:00-17:00)
400 675 1066
mingrisoft@mingrisoft.com
吉林省明日科技有限公司Copyright ©2007-2022,mingrisoft.com, All Rights Reserved长春市北湖科技开发区盛北大街3333号长春北湖科技园项目一期A10号楼四、五层
吉ICP备10002740号-2吉公网安备22010202000132经营性网站备案信息 营业执照