标题:access数据库与VB连用问题
只看楼主
梦昔梦矣
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2018-4-16
结帖率:100%
 问题点数:0 回复次数:1 
access数据库与VB连用问题
各位大神:
    我编程为什么出现这种情况,跪求帮忙
代码:Private Sub Command1_Click()
Dim a!, b!, c!
Dim l(1 To 5)  As Single
Dim h(1 To 5)  As Single
Dim Ls(1 To 5) As Single
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\电影\Database13.mdb;Persist Security Info=False"
= adCmdUnknown
Adodc1.RecordSource = "select * from 表1"
Adodc1.Refresh
For a = 1 To 5
   l(a) = Val(Adodc1.Recordset.Fields(1))
   Adodc1.Recordset.MoveNext
Next a
For a = 1 To 5
   h(a) = Val(Adodc1.Recordset.Fields(2))
   Adodc1.Recordset.MoveNext
Next a
c = 1
Do While c < 6
  Ls(c) = h(c) + l(c)
  Label1.Caption = Label1.Caption & Ls(c) & vbCrLf
  c = c + 1
Loop
End Sub
然后出现

数据库是
搜索更多相关主题的帖子: access 数据库 Dim Single Recordset 
2018-04-24 10:52
yingshu
Rank: 4
等 级:贵宾
威 望:10
帖 子:49
专家分:212
注 册:2018-7-24
得分:0 
出现上述错误代码,主要是这段代码
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\电影\Database13.mdb;Persist Security Info=False"
= adCmdUnknown
Adodc1.RecordSource = "select * from 表1"
Adodc1.Refresh

connection对象和recordset对象没执行open方法打开,当然没有记录
2018-10-29 01:11



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




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

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