怎么不对?

来源:百度知道 编辑:UC知道 时间:2024/06/23 18:27:25
ublic Sub showdata()
Dim i As Integer
Adodc1.RecordSource = "select * from P2"
Adodc1.Refresh
If Not Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveFirst
MSF.TextMatrix(1, 0) = Adodc1.Recordset.Fields(0)
MSF.TextMatrix(1, 1) = Adodc1.Recordset.Fields(1)
MSF.TextMatrix(1, 2) = Adodc1.Recordset.Fields(2)
MSF.TextMatrix(1, 3) = Adodc1.Recordset.Fields(3)
MSF.TextMatrix(1, 4) = Adodc1.Recordset.Fields(4)
MSF.TextMatrix(1, 5) = Adodc1.Recordset.Fields(5)
Adodc1.Recordset.MoveNext
For i = 2 To Adodc1.Recordset.RecordCount
With Adodc1.Recordset
MSF.AddItem .Fields(0) & vbTab & .Fields(1)
.MoveNext
End With
Next i
End If
Adodc1.Recordset.Close
End Sub

Public Sub showtitle()
With MSF
.Rows = 2
.Cols = 6
.TextMatrix(0, 0) = "姓名"
.TextMatrix(0, 1) = "性别"
.TextMatrix(0, 2) = "年龄"
.TextMatrix(0, 3) = "出

把 if Not Adodc1.Recordset.EOF改成
while Not Adodc1.Recordset.EOF,具体代码:
Public Sub showdata()
Dim i As Integer
Adodc1.RecordSource = "select * from P2"
Adodc1.Refresh
While Not Adodc1.Recordset.EOF
Adodc1.Recordset.MoveFirst
MSF.TextMatrix(1, 0) = Adodc1.Recordset.Fields(0)
MSF.TextMatrix(1, 1) = Adodc1.Recordset.Fields(1)
MSF.TextMatrix(1, 2) = Adodc1.Recordset.Fields(2)
MSF.TextMatrix(1, 3) = Adodc1.Recordset.Fields(3)
MSF.TextMatrix(1, 4) = Adodc1.Recordset.Fields(4)
MSF.TextMatrix(1, 5) = Adodc1.Recordset.Fields(5)
Adodc1.Recordset.MoveNext
For i = 2 To Adodc1.Recordset.RecordCount
With Adodc1.Recordset
MSF.AddItem .Fields(0) & vbTab & .Fields(1)
.MoveNext
End With
Next i
Wend
Adodc1.Recordset.Close
End Sub

Public