初学vb 求助
Private Sub Form_Load()Dim conn As New ADODB.Connection
Dim connectionstring As String
connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & ".\db1.mdb;Persist Security Info=False"
conn.Open connectionstring
End Sub
Private Sub Command1_Click()
Dim sql As String
Dim conn As New ADODB.Connection
Dim rs_login As New ADODB.Recordset
If Trim(Text1.Text) = "" Then '检测用户名正确与否
MsgBox "用户名不能为空,请重新输入!", vbOKOnly + vbExclamation, "错误"
Text1.SetFocus
Else
Set rs_login = New ADODB.Recordset
Set conn = New ADODB.Connection
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & ".\db1.mdb;Persist Security Info=False"
sql = "select * from LOGIN where USERID = '" & Text1.Text & "'"
rs_login.Open sql, conn, 1, 1 ///至少有一个参数未被指定
If rs_login.EOF = True Then
MsgBox "用户名不存在,请重新输入!", vbOKOnly + vbExclamation, "错误"
Text1 = ""
Text2 = ""
Text1.SetFocus
Else '检测密码正确与否
If Trim(rs_login.Fields(1)) = Trim(Text2) Then
If Trim(rs_login.Fields(2)) = Trim(Combo1.Text) Then
rs_login.Close
Unload Me
Form1.Show
Else
MsgBox "身份错误,请重新选择!", vbOKOnly + vbExclamation, "错误"
Combo1.SetFocus
End If
Else
MsgBox "密码错误,请重新输入!", vbOKOnly + vbExclamation, "错误"
Text2 = ""
Text2.SetFocus
End If
End If
End If
End Sub
运行后提示红色处至少有一个参数未被指定 ,新手初学,请大家帮忙调试一下 谢谢!!