用DAO连接数据库,下面的程序为善不能显示数据库中的内容,引用也设置了,就不知道为啥,就这么多分了
PrivateSubForm_Click()DimiAsIntegerFori=1To8Me.PrintLiangCheng(i)NextiEndSub模块中的是Opti...
Private Sub Form_Click()
Dim i As Integer
For i = 1 To 8
Me.Print LiangCheng(i)
Next i
End Sub
模块中的是
Option Explicit
Public Const DBPath = "C:\Documents and Settings\Administrator\桌面\数据库小程序\DAO\DATABASE\MCDB.mdb"
Global myWS As Workspace
Global LiangCheng(1 To 8) As Double
Global myDB As Database
Sub LiangChengInit()
Dim k As Integer
Dim myRS As Recordset
Set myRS = myDB.OpenRecordset("LiangChengTable") '打开数据路记录
myRS.MoveFirst '移到记录第一行
For k = 1 To 7
LiangCheng(k) = myRS![量程] '赋值
myRS.MoveNext
Next k
myRS.Close
End Sub 展开
Dim i As Integer
For i = 1 To 8
Me.Print LiangCheng(i)
Next i
End Sub
模块中的是
Option Explicit
Public Const DBPath = "C:\Documents and Settings\Administrator\桌面\数据库小程序\DAO\DATABASE\MCDB.mdb"
Global myWS As Workspace
Global LiangCheng(1 To 8) As Double
Global myDB As Database
Sub LiangChengInit()
Dim k As Integer
Dim myRS As Recordset
Set myRS = myDB.OpenRecordset("LiangChengTable") '打开数据路记录
myRS.MoveFirst '移到记录第一行
For k = 1 To 7
LiangCheng(k) = myRS![量程] '赋值
myRS.MoveNext
Next k
myRS.Close
End Sub 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询