统计记录失败,各们大侠,请帮我看一下这个问题哈!

tgq1981 2003-09-11 09:13:37
Dim cnnExample As New ADODB.Connection
Dim rsExample As New ADODB.Recordset

cnnExample.Provider = "Microsoft.Jet.OLEDB.4.0"
cnnExample.ConnectionString = "data source=g:\WORK\VB\db1.mdb"
cnnExample.Open
Set rsExample.ActiveConnection = cnnExample

rsExample.Open "select * from example where example.name='" & Combo1.Text & "'"
MsgBox (rsExample.RecordCount) 在运行到此句时,总是返回记录数为-1。请问这是怎么一回事,有什么方法,可以统计出筛选出来的记录的记录数?谢谢。
...全文
149 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
aohan 2003-09-11
  • 打赏
  • 举报
回复
上面的trim()位置有点错误,得放到里面:)
aohan 2003-09-11
  • 打赏
  • 举报
回复
rsExample.Open "select * from example where example.name='" & Combo1.Text & "'"
改为rsExample.Open "select * from example where example.name='trim(" & Combo1.Text & ")'",cnnExample,1,3
试试看

rachelnie 2003-09-11
  • 打赏
  • 举报
回复
其中一句改为:
rsExample.Open "select * from example where example.name='" & Combo1.Text & "'",3,3,1
试试
good luck
tgq1981 2003-09-11
  • 打赏
  • 举报
回复
谢谢啦,我回去试试!!!!!!!!!!!!!

1,217

社区成员

发帖
与我相关
我的任务
社区描述
VB 数据库(包含打印,安装,报表)
社区管理员
  • 数据库(包含打印,安装,报表)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧