以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]出现由于线程退出或应用程序请求错误  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=171281)

--  作者:sunion
--  发布时间:2021/8/25 10:33:00
--  [求助]出现由于线程退出或应用程序请求错误
运行代码,服务器出现“由于线程退出或应用程序请求,已终止I/O操作”
Case "receive2.htm"
        wb.AddForm("","form1","receive2.htm")
        For Each key As String In e.Files.Keys
            If e.Files(key).count > 9 Then     \'---------------补充
                e.WriteString("照片不能多于9张!!")\'---------------补充
                Return \'---------------补充
            End If        
            Dim nms() As String = {"文章内容"}
            For Each nm As String In nms
                If e.PostValues.ContainsKey(nm) = False Then \'生成错误提示页
                    e.WriteString(nm & "内容不能为空!")
                    Return \'必须返回
                End If
            Next          
            Dim nmc() As String = {"文章内容"}
            Dim dra As DataRow = DataTables("班级圈").AddNew()
            For Each nn As String In nmc
                dra(nn) = e.PostValues(nn)
                dra("录入日期") = Date.Now
                dra("录入员")  =  username
                dra("学校")  =  schoolname
                Dim tim As String = Format(Date.Now,"yyyyMMddHHmmssffff")
                dra("文章编号") =  tim  &  schoolname  &  username
                Dim dmv As DataRow = DataTables("用户表").Find("姓名 = \'" & UserName & "\' and 学校 = \'" & SchoolName & "\'" )    \'寻找对应标题的行
                If dmv IsNot Nothing Then \'如果找到的话
                    dra("教育格言") = dmv("教育格言")
                End If
            Next          
            If key = "up4" Then
                Dim lst As List(of String) = dra.Lines("文章照片")
                For Each fln As String In e.Files(key)
                    Dim n As String = Format(Date.Now,"yyyyMMddHHmmssffff") & fln
                    e.SaveFile(key, fln, "e:\\web\\images\\uploadfiles\\" & n)
                    lst.Add(n)                
                    Dim file As String = "e:\\web\\images\\uploadfiles\\" & n
                    Dim img As image = getImage(file)
                    Dim bmp As new bitmap(img, 100, 100 * (img.height / img.width))
                    bmp.save("e:\\web\\images\\缩略图\\" & n)
                    bmp.Dispose
                Next
                dra.Lines("文章照片") = lst
            End If
            dra.save()
            e.WriteString("ok")
        Next

图片点击可在新窗口打开查看此主题相关图片如下:微信截图_20210825103333.png
图片点击可在新窗口打开查看

[此贴子已经被作者于2021/8/25 10:34:04编辑过]

--  作者:有点蓝
--  发布时间:2021/8/25 10:41:00
--  
BeforeShowErrorMessage屏蔽掉这个错误,参考:http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=157067&replyID=99170&skin=1