这段代码为何不能正确检测用户输入的登录名??详细解答者100分
Private Sub cmdOK_Click()
Adodc1.Recordset.Find Adodc1.Recordset.Fields(0).Name & "='" & txtUserName & "'" '查代号
If Adodc1.Recordset.EOF Then
MsgBox "ID不存在!!"
Adodc1.Recordset.Find Adodc1.Recordset.Fields(1).Name & "='" & txtUserName & "'" '查用户名
If Adodc1.Recordset.EOF Then
MsgBox "用户不存在!!"
End If
End Sub
adodc1连接到一用户表(此表第一个字段为用户ID,第二个字段为用户名,txtusername为文本框,既接受用户名,接受用户ID),若输入正确的ID,能正确的判断,但只要输入了一次不用户名(不能表中是否存在),都不能检测到,且再次输入正确的用户ID也不能检测了,不知是故??
问题点数:100、回复次数:3Top
1 楼sxs69()回复于 2003-05-01 17:34:32 得分 100
Private Sub cmdOK_Click()
Adodc1.Recordset.Find "id ='" & txtUserName & "'" '查代号
If Adodc1.Recordset.EOF Then
MsgBox "ID不存在!!"
Adodc1.Recordset.MoveFirst '加上这一句
Adodc1.Recordset.Find "用户名='" & txtUserName & "'" '查用户名
If Adodc1.Recordset.EOF Then
MsgBox "用户不存在!!"
End If
End If
Adodc1.Recordset.MoveFirst '加上这一句
End Sub
Top
2 楼sealy(情趣生)回复于 2003-05-03 18:15:41 得分 0
find方法只是从当前位置向后查找??希望给个find方法的详细语法!!
我已经给分了哦!!
谢谢谢!!!!Top




