Foxtable(狐表)用户栏目专家坐堂 → 登录按钮代码 运行之后 项目要等待好久才能进入主窗口 麻烦老师帮忙看看有没有办法再优化一下代码 减少等待响应时间呢?


  共有2764人关注过本帖平板打印复制链接

主题:登录按钮代码 运行之后 项目要等待好久才能进入主窗口 麻烦老师帮忙看看有没有办法再优化一下代码 减少等待响应时间呢?

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


加好友 发短信
等级:七尾狐 帖子:1571 积分:11238 威望:0 精华:0 注册:2021/1/17 17:06:00
登录按钮代码 运行之后 项目要等待好久才能进入主窗口 麻烦老师帮忙看看有没有办法再优化一下代码 减少等待响应时间呢?  发帖心情 Post By:2021/7/4 8:54:00 [只看该作者]

登录按钮代码  运行之后 项目要等待好久才能进入主窗口  麻烦老师帮忙看看有没有办法再优化一下代码 减少等待响应时间呢?

图片点击可在新窗口打开查看此主题相关图片如下:捕获.png
图片点击可在新窗口打开查看
代码如下:
Dim cmd As New SQ LCommand
cmd.Connect ion Name = _DATA
If e.Form.Controls("ComboBox1").Value = ""  Then
    Messagebox.show("请选择单位或者输入单位!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    Return
Else  If e.Form.Controls("UserName").Value = ""  Then
    Messagebox.show("请选择用户或者输入用户名!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    Return
Else If e.Form.Controls("PassWord").Value = ""  Then
    Messagebox.show("请输入密码!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    Return
Else
    cmd.CommandText = "Se lect * From {systemuser} Where [username] = '" & e.Form.Controls("UserName").Value & "'"
    Dim dt As DataTable = cmd.ExecuteReader
    If dt.DataRows.Count = 0 Then
        Messagebox.show("此用户不存在!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
        Return
    End If
    Dim dr As DataRow = dt.DataRows(0)
    If e.Form.Controls("PassWord").Value = dr("Password") And e.Form.Controls("ComboBox1").Value = dr("所在单位") Then
        _UserName = e.Form.Controls("UserName").Value
        _UserGroup = dr("所在单位")
        _DATA=e.Form.Controls("ComboBox2").Value
        vars("单位")=dr("所在单位")
        e.Form.Close
        Forms("主窗口").show
    Else
        Messagebox.show("所在单位或用户名或密码输入错误!,请核查!","温馨提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    End If
End If
[此贴子已经被作者于2021/7/4 8:55:20编辑过]

 回到顶部