代码如下:
模块:
Public objcn As New ADODB.Connection
Public objrs As New ADODB.Recordset
Public sqlstr As String
Public str1 As String
Public ss As Integer
Public Sub openku()
str1 = "Provider=Microsoft.Jet.OLEDB.4.0;"
str1 = str1 & "Data Source=" & App.Path & "\用户表.mdb"
objcn.ConnectionString = str1
objcn.Open
End Sub
执行代码:
If Combo1.Text = "游客" Then
Unload Me
Form2.Show
MsgBox "登陆成功", vbokly
Else
If textname = "" Then MsgBox "请输入用户名", vbOKOnly: textname.Text = "": textpass.Text = "": textname.SetFocus
If textpass = "" Then MsgBox "请输入密码", vbOKOnly: textname.Text = "": textpass = ""
If textname <> "" And textpass <> "" Then
Call openku
sqlstr = "select * from 用户信息表 where 用户名='" & Trim(textname.Text) & "' and 密码='" & Trim(textpass.Text) & "'"
objrs.ActiveConnection = objcn
objrs.Open sqlstr, objcn
If objrs.EOF Then
MsgBox "请重置用户信息", vbOKOnly
Unload Me
Exit Sub
Else
Unload Me
Form2.Show
MsgBox "登陆成功", vbOKOnly
End If
End If
End If
End Sub
Private Sub Form_Load()
Combo1.AddItem "管理员"
Combo1.AddItem "普通用户"
Combo1.AddItem "游客"
End Sub
提示说 objrs.Open sqlstr, objcn有问题
错误类型:2147217913
标准表达式中数据类型不匹配。
哪位大哥帮个忙啊~~~~~