请各位大哥帮忙看下代码错在哪里?
Public cn As New ADODB.ConnectionSub main()
Set cn = New ADODB.Connection
cn.CursorLocation = adUseClient
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\boss.mdb;Persist Security Info=False"
End Sub
Private Sub cmd_login_Click(Index As Integer)
If txt_user.Text = Empty Then
MsgBox "用户名不能为空!", vbOKOnly + vbInformation, "客户信息管理系统登录提示"
txt_user.SetFocus
Exit Sub
End If
If txt_pass.Text = Empty Then
MsgBox "密码不能为空!", vbOKOnly + vbInformation, "客户信息管理系统登录提示"
txt_pass.SetFocus
Exit Sub
End If
Dim strsql As String
strsql = "select * from [admin] where 管理员姓名='" & Trim$(txt_user.Text) & "' and 管理员密码='" & Trim$(txt_pass.Text) & "' "
Dim str As ADODB.Recordset
Set str = New ADODB.Recordset
str.CursorLocation = adUseClient
str.Open strsql, conn, adOpenStatic, adLockReadOnly
With str
If .State = adStateOpen Then .Close
.Open strsql
If .EOF Then
Try_times = Try_times + 1
If Try_times >= 3 Then
MsgBox "您已经三次尝试进入本系统,均不成功,系统将自动关闭", vbOKOnly + vbCritical, "警告"
Unload Me
Else
MsgBox "对不起,用户名不存在或密码错误 !", vbOKOnly + vbQuestion, "警告"
txt_user.SetFocus
txt_user.Text = ""
txt_pass.Text = ""
End If
Else
Unload Me
frmmian.Show
End If
End With
End Sub
老是提示参数类型不正确或不在可接受范围内或与其他参数冲突