VB如何把ACCESS数据库中的记录给数组啊
我想把ACCESS数据库中的两条记录给一维数组,但是为什么一运行时,都是空或者0。那位好心人帮我指点下啊,程序如下:PrivateSubCommand1_Click()D...
我想把ACCESS数据库中的两条记录给一维数组 ,但是为什么一运行时,都是空或者0 。那位好心人帮我指点下啊,程序如下:
Private Sub Command1_Click()
Dim daozhan(1 To 100) As String
Dim liangshu(1 To 500) As Integer
Dim j As Integer
Dim conn As New ADODB.Connection, rs As New ADODB.Recordset
Dim strSQL As String
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;DataSource=F/PATH strSQL = "Select * From 本站现存车信息表 "
rs.Open strSQL, conn, 1, 3
For j = rs.RecordCount To 1
rs.Move (j - 1)
daozhan(j) = rs.Fields(2)
liangshu(j) = rs.Fields(5)
Next
For j = 1 To rs.RecordCount
Print daozhan(j), liangshu(j)
Next
End Sub 展开
Private Sub Command1_Click()
Dim daozhan(1 To 100) As String
Dim liangshu(1 To 500) As Integer
Dim j As Integer
Dim conn As New ADODB.Connection, rs As New ADODB.Recordset
Dim strSQL As String
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;DataSource=F/PATH strSQL = "Select * From 本站现存车信息表 "
rs.Open strSQL, conn, 1, 3
For j = rs.RecordCount To 1
rs.Move (j - 1)
daozhan(j) = rs.Fields(2)
liangshu(j) = rs.Fields(5)
Next
For j = 1 To rs.RecordCount
Print daozhan(j), liangshu(j)
Next
End Sub 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询