菲律宾百岛国家公园:请问个位大虾,这段程序是什莫意思,可否给单句注释

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/01 19:26:13
Private Sub Image1_Click()
Dim mrc As ADODB.Recordset
txtsql = "select username from use where username='" & Trim(Text1.Text) & "'"
Set mrc = ExecuteSQL(txtsql)
If mrc.EOF = True Then
MsgBox " 用户名错误!", vbExclamation + vbOKOnly, "警告"
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Exit Sub
End If
username = mrc.Fields(0)
txtsql = "select username from use where password='" & Trim(Text2.Text) & "'"
Set mrc = ExecuteSQL(txtsql)
If mrc.EOF = True Then
MsgBox " 密码错误!", vbExclamation + vbOKOnly, "警告"
Text2.SetFocus
Text2.SelStart = 0
Text2.SelLength = Len(Text2.Text)
Exit Sub
End If
chaxun.Show
qidong.Hide
denglu.Hide
End Sub

Private Sub Image2_Click()
qidong.Show
denglu.Hide
End Sub

Private Sub image1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub

Private Sub image2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub

Private Sub Image1_Click() 在第一个图片上单击
Dim mrc As ADODB.Recordset 定义mrc变量数据库记录集
txtsql = "select username from use where username='" & Trim(Text1.Text) & "'" 查找数据库里有没有在text1.text输入的用户
Set mrc = ExecuteSQL(txtsql) 执行查询,并把结果返回给mrc
If mrc.EOF = True Then 如果mrc什么都没有,说明没有这个用户
MsgBox " 用户名错误!", vbExclamation + vbOKOnly, "警告" 显示信息
Text1.SetFocus 把光标定到text1里
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text) 这2句是选中text1中的字符.
Exit Sub 退出过程
End If
username = mrc.Fields(0) 将用户名放在变量username里
txtsql = "select username from use where password='" & Trim(Text2.Text) & "'" 同上,查找有没有密码跟text2里相同的用户
Set mrc = ExecuteSQL(txtsql) 同上
If mrc.EOF = True Then
MsgBox " 密码错误!", vbExclamation + vbOKOnly, "警告"
Text2.SetFocus
Text2.SelStart = 0
Text2.SelLength = Len(Text2.Text)
Exit Sub
End If
chaxun.Show 显示查询窗口
qidong.Hide 隐藏启动窗口
denglu.Hide 隐藏登陆窗口
End Sub

Private Sub Image2_Click() 在第二个图片上单击
qidong.Show 显示启动窗口
denglu.Hide 隐藏登陆
End Sub

Private Sub image1_KeyPress(KeyAscii As Integer) 在第一个图片上按键
If KeyAscii = 13 Then 如果是回车键
Text2.SetFocus 光标移到text2里
End If
End Sub

Private Sub image2_KeyPress(KeyAscii As Integer) 同上
If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub