
在关键字'select'附近有语法错误——对象'Refresh'的方法'IAdodc'失败 5
'单击“确定”按钮执行PrivateSubCommand1_Click()DimsqlStrAsStringIfTrim(txtuser.Text)=""Then'判断输...
'单击“确定”按钮执行
Private Sub Command1_Click()
Dim sqlStr As String
If Trim(txtuser.Text) = "" Then '判断输入的用户名是否为空
MsgBox "请输入用户名", vbOKOnly + vbExclamation, ""
txtuser.SetFocus
Else
sqlStr = "select * from User_Info where username='" _
& Trim(txtuser) & "'"
Adodc1.RecordSource = sqlStr
Adodc1.Refresh
If Adodc1.Recordset.EOF Then
MsgBox "没有这个用户", vbOKOnly + vbExclamation, ""
txtuser.SetFocus
Else '检验密码是否正确
If Trim(Adodc1.Recordset.Fields("type")) <> Trim(Combo1.Text) Then
MsgBox "没有符合条件的用户", vbOKOnly + vbExclamation, ""
Else
If Trim(Adodc1.Recordset.Fields("password")) = Trim(txtpwd) Then
userID = txtuser
If Combo1.Text = "管理员" Then
usertype = 1
Else
usertype = 2
End If
Unload Me
MDIForm1.Show
Else
MsgBox "密码不正确", vbOKOnly + vbExclamation
txtpwd.SetFocus
End If
End If
End If
End If
cnt = cnt + 1
If cnt = 3 Then
Unload Me
End If
End Sub 展开
Private Sub Command1_Click()
Dim sqlStr As String
If Trim(txtuser.Text) = "" Then '判断输入的用户名是否为空
MsgBox "请输入用户名", vbOKOnly + vbExclamation, ""
txtuser.SetFocus
Else
sqlStr = "select * from User_Info where username='" _
& Trim(txtuser) & "'"
Adodc1.RecordSource = sqlStr
Adodc1.Refresh
If Adodc1.Recordset.EOF Then
MsgBox "没有这个用户", vbOKOnly + vbExclamation, ""
txtuser.SetFocus
Else '检验密码是否正确
If Trim(Adodc1.Recordset.Fields("type")) <> Trim(Combo1.Text) Then
MsgBox "没有符合条件的用户", vbOKOnly + vbExclamation, ""
Else
If Trim(Adodc1.Recordset.Fields("password")) = Trim(txtpwd) Then
userID = txtuser
If Combo1.Text = "管理员" Then
usertype = 1
Else
usertype = 2
End If
Unload Me
MDIForm1.Show
Else
MsgBox "密码不正确", vbOKOnly + vbExclamation
txtpwd.SetFocus
End If
End If
End If
End If
cnt = cnt + 1
If cnt = 3 Then
Unload Me
End If
End Sub 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询