以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  导出Excel报表死机  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=142859)

--  作者:蓝蚂蚁
--  发布时间:2019/11/7 17:34:00
--  导出Excel报表死机

弹窗中有一按钮,代码如下:

Dim str As String
Dim str2 As String =e.Form.Controls("TextBox3").value \'清单列入月份
Dim rb1 As String  ="溯源追踪"
Dim rb2 As String  ="验收登记"
Dim clb1 As String =e.Form.Controls("CheckedListBox1").value

Dim Book1 As New XLS.Book(ProjectPath & "Attachments\\新版溯源追踪.xls")
Dim fl As String = ProjectPath & "AllMyFiles\\溯源追踪记录\\" & str2 & clb1 & rb1 &".xls"
Book1.Build() \'生成细节区
Book1.Save(fl) \'保存工作簿
Dim Proc1 As New Process \'打开工作簿
Proc1.File = fl
Proc1.Start()

Dim Book2 As New XLS.Book(ProjectPath & "Attachments\\新版高值植入耗材验收记录.xls")
Dim f2 As String = ProjectPath & "AllMyFiles\\高值验收记录\\" & str2 & clb1 & rb2 &".xls"
Book2.Build() \'生成细节区
Book2.Save(f2) \'保存工作簿
Dim Proc2 As New Process \'打开工作簿
Proc2.File = f2
Proc2.Start()


Dim dr As DataRow = DataTables("验收溯源登记时间标志表").Find("配送公司 =\'"& clb1 &"\'")
If dr IsNot Nothing Then \'如果找到的话
    dr("最新溯源截止时间")=str2
    dr("最新验收截止时间")=str2
Else
    Dim dr2 As DataRow = DataTables("验收溯源登记时间标志表").AddNew()
    dr2("配送公司")=clb1
    dr("最新溯源截止时间")=str2
    dr("最新验收截止时间")=str2
End If

 

问题:在用户的自定义菜单中打开这个弹窗,在弹窗中点击这个按钮,项目就死机了,但我在系统的菜单中--窗口管理--设计窗口--浏览,点击这个按钮却能正常导入Excel报表,不知道和解?我从之前(3个月前)的备份中,验证了在用户自定义菜单中能正常使用,麻烦老师帮看看到底是什么问题?

[此贴子已经被作者于2019/11/7 17:36:59编辑过]

--  作者:狐狸爸爸
--  发布时间:2019/11/7 19:49:00
--  
用这个分析一下,看看执行到哪里死了:


--  作者:蓝蚂蚁
--  发布时间:2019/11/7 19:58:00
--  

Dim str As String
Dim str2 As String =e.Form.Controls("TextBox3").value \'清单列入月份
Dim rb1 As String ="溯源追踪"
Dim rb2 As String ="验收登记"
Dim clb1 As String =e.Form.Controls("CheckedListBox1").value

MessageBox.Show(1)  只显示到这里


--  作者:有点酸
--  发布时间:2019/11/7 23:26:00
--  
重新设计新版溯源追踪.xls这个模板