在关键字'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
展开
 我来答
速动科技
2013-07-01 · TA获得超过108个赞
知道小有建树答主
回答量:205
采纳率:75%
帮助的人:102万
展开全部
应该是SQL语句中有错误!

sqlStr = "select * from User_Info where username='" _
& Trim(txtuser) & "'"

应该是 txtuser.Text 吧。不是txtuser
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式