求助,关于数据库中数据保存到数组
朋友们,我想把数据库(data.mdb)中表(davis)中的两个字段(字段1、字段2)中数据保存到两个数组中,然后在picture上作为X、Y坐标显示出来,最后连接这些点做成一个折线图。下面是我的代码。Private Sub Command4_Click()
Picture1.Cls
Picture1.ScaleMode = 0.5
Picture1.Scale (-2, 10)-(10, -10)
Picture1.DrawWidth = 1
Picture1.Line (-1, 0)-(9, 0), vbBlue
Picture1.Line (8.5, 0.5)-(9, 0), vbBlue
Picture1.Line (8.5, -0.5)-(9, 0), vbBlue
Picture1.ForeColor = vbBlue
Picture1.Print "X"
Picture1.Line (0, -9)-(0, 9), vbBlue
Picture1.Line (0.2, 8.5)-(0, 9), vbBlue
Picture1.Line (-0.2, 8.5)-(0, 9), vbBlue
Picture1.Print "Y"
For i = -8 To 8 Step 2
Picture1.CurrentX = 0
Picture1.CurrentY = i
Picture1.PSet (0.02, i)
Picture1.Print i
Next
For i = 0 To 8 Step 1
Picture1.CurrentX = i
Picture1.CurrentY = 0
Picture1.PSet (i, 0.02)
Picture1.Print i
Next 以上是坐标系得代码,已经运行,没有错误。
Dim Conn As New ADODB.Connection
Dim Rs As New ADODB.Recordset
Dim m As Long, Rc As Long
Dim Zx() As Double, Zy() As Double
Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\data.mdb;Persist Security Info=False"
Conn.Open "select 字段1,字段2 from Davis", Conn, 1, 1
Rc = Rs.RecordCount
ReDim Zx(Rc) As Double
ReDim Zy(Rc) As Double
For m = 0 To Rc - 1
Zx(m) = Rs(0)
Zy(m) = Rs(1)
Rs.MoveNext
Next
For m = 0 To 9
Line (Zx(m), Zy(m))-(Zx(m), Zy(m))
Next
End Sub 以上是在picture上表达出来,然后画折线图
最后程序还是无法运行,,求各位帮帮忙!!谢谢