Foxtable(狐表)用户栏目专家坐堂 → 能不能帮我看看这个代码是否有问题,有时会闪退


  共有3166人关注过本帖树形打印复制链接

主题:能不能帮我看看这个代码是否有问题,有时会闪退

帅哥哟,离线,有人找我吗?
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:112401 积分:572273 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/12/12 15:57:00 [显示全部帖子]

看不出什么问题,不过可以优化一下

Dim ftp1 As New FtpClient
ftp1.Host=Tables("FTPIP").Current("FTPhost")
ftp1.Account = Tables("FTPIP").Current("FTPAccount")
ftp1.Password = Tables("FTPIP").Current("FTPpassword")
Dim r As Row = Tables("员工信息_员工信息").current
Dim l As String = "/身份证/"& r("证件号码") + r("员工姓名")
msgbox(l)
Dim dlg As New FolderBrowserDialog '选择目录对话框
dlg.Description = "选择文件夹" '对话框的说明
dlg.ShowNewFolderButton = False '不显示"新建文件夹"按钮
If dlg.ShowDialog = DialogResult.Ok Then '如果单击确定
    MessageBox.Show("你选择的目录是:" & dlg.SelectedPath ,"提示")
    Dim f As String = dlg.SelectedPath & "\" & r("员工姓名")  & "1.jpg"
    Dim f1 As String = dlg.SelectedPath & "\" & r("员工姓名")  & "2.jpg"
    Dim sf As String =  r("证件图1")
msgbox(sf) '这里弹出的值是否正确
    Dim sf1 As String = r("证件图2")
msgbox(sf1)
    If  ftp1.DirExists(l) = False  Then
        If ftp1.MakeDir(l) = False Then
            Messagebox.Show("创建目录失败,请联系管理员!")
            Return
        End If
    End If
    If FileSys.FileExists(f) Then
        If  ftp1.Upload(f,sf) = True Then
            Messagebox.show("" &r("员工姓名")&" 身份证正面上传完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
        Else
            Messagebox.show("" &r("员工姓名")&" 身份证正面上传失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
        End If
    Else
        Messagebox.show("没有找到 " &r("员工姓名")&" 的身份证(正面)图片!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    End If
    If FileSys.FileExists(f1) Then
        If  ftp1.Upload(f1,sf1) = True Then
            Messagebox.show("" &r("员工姓名")&" 身份证反面上传完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
        Else
            Messagebox.show("" &r("员工姓名")&" 身份证反面上传失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
        End If
    Else
        Messagebox.show("没有找到 " &r("员工姓名")&" 的身份证(反面)图片!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    End If
    If DataTables("员工信息_员工信息").HasChanges Then
        DataTables("员工信息_员工信息").Save
    End If
    Tables("员工信息_员工信息").RaisePositionChanged()
End If


 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:112401 积分:572273 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/12/13 8:43:00 [显示全部帖子]

看不出什么问题。做个完整可以测试的项目发上来

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:112401 积分:572273 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/12/13 10:31:00 [显示全部帖子]

联系客服QQ:800014337

 回到顶部