怎么才能查找第一个下面的数据啊
我这是登录界面要用数据库里的学生的学号,但我只能用第一个登录成功,下面的都不行,请各位看看,怎么才能实现让每个学号都能登录成功啊,谢谢!!
Private Sub CommandButton1_Click()
If Text1.Text = " " Or Text2.Text = " " Then
a = MsgBox( "请输入用户名或密码 ", , "提示 ")
Else
strsql = "select * from basic_information "
Login.Adodc1.RecordSource = strsql
Login.Adodc1.Refresh
Login.Adodc1.Recordset.MoveFirst
End If
With Login.Adodc1.Recordset
Do While Not .EOF
If (OptionButton1.Value = True And Text1.Text = Trim(.Fields( "studentid ")) And Text2.Text = Trim(.Fields( "studentid "))) Or (OptionButton2.Value = True And Text1.Text = "teacher " And Text2.Text = "teacher ") Or (OptionButton3.Value = True And Text1.Text = "admin " And Text2.Text = "admin ") Then
Main.Show
Unload Me
Else
a = MsgBox( "用户名或密码或登录身份不正确 ", , "提示 ")
End If
Exit Do
Loop
End With
End Sub
[解决办法]
什不用
strsql = "select * from basic_information where studentid= ' " & Text1.Text & " ' "
and ... "直接判中是否有