登录按钮代码 运行之后 项目要等待好久才能进入主窗口 麻烦老师帮忙看看有没有办法再优化一下代码 减少等待响应时间呢?
此主题相关图片如下:捕获.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编辑过]