标题:vb6关于ado连access的问题
只看楼主
zczhou
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2007-6-7
 问题点数:0 回复次数:0 
vb6关于ado连access的问题

代码如下:

模块:


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
标准表达式中数据类型不匹配。
哪位大哥帮个忙啊~~~~~

搜索更多相关主题的帖子: ado access 
2007-06-07 19:51



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-145762-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.222707 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved