Private Sub Command1_Click()
Dim sql As String
Dim rs As New ADODB.Recordset
Set rs = New ADODB.Recordset
Dim pwdcount As Integer
pwdcount = 0
If Trim(Text1.Text = "") Then
MsgBox "没有输入用户名称,请重新输入!", vbOKOnly + vbExclamation, "警告"
Text1.SetFocus
Else '查询用户
sql = "select * from 用户 where 用户名='" & Text1.Text & "'"
Set rs = TransactSQL(sql)
If iflag = 1 Then
If rs.EOF = True Then
MsgBox "没有这个用户,请重新输入!", vbOKOnly + vbExclamation, "警告"
Text1.SetFocus
Else
If Trim(rs.Fields(1)) = Trim(Text2.Text) Then
rs.Close
Me.Hide
main.Show
Unload Me
Else
MsgBox "密码不正确,请重新输入!", vbOKOnly + vbExclamation, "警告"
Text2.SetFocus
Text2.Text = ""
End If
End If
Else
Unload Me
End If
End If
pwdcount = pwdcount + 1 '判断输入次数
If pwdcount = 3 Then
Unload Me
Exit Sub
End IfEnd Sub
为什么每次都说我的用户类型未定义呢
Dim sql As String
Dim rs As New ADODB.Recordset
Set rs = New ADODB.Recordset
Dim pwdcount As Integer
pwdcount = 0
If Trim(Text1.Text = "") Then
MsgBox "没有输入用户名称,请重新输入!", vbOKOnly + vbExclamation, "警告"
Text1.SetFocus
Else '查询用户
sql = "select * from 用户 where 用户名='" & Text1.Text & "'"
Set rs = TransactSQL(sql)
If iflag = 1 Then
If rs.EOF = True Then
MsgBox "没有这个用户,请重新输入!", vbOKOnly + vbExclamation, "警告"
Text1.SetFocus
Else
If Trim(rs.Fields(1)) = Trim(Text2.Text) Then
rs.Close
Me.Hide
main.Show
Unload Me
Else
MsgBox "密码不正确,请重新输入!", vbOKOnly + vbExclamation, "警告"
Text2.SetFocus
Text2.Text = ""
End If
End If
Else
Unload Me
End If
End If
pwdcount = pwdcount + 1 '判断输入次数
If pwdcount = 3 Then
Unload Me
Exit Sub
End IfEnd Sub
为什么每次都说我的用户类型未定义呢
iflag这个变量在哪定义了?
麻烦高手指点了,谢谢