|
本帖最后由 luhao 于 2009-6-13 07:01 编辑
Private Sub xlistview(openDB as string,xlistview as control)
Dim startTime, endTime As Date
Dim s As Single
startTime = Now()
Dim cn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim rstCount As New ADODB.Recordset
Dim intNow, intTotal As Integer
Set cn = CurrentProject.Connection
rst.ActiveConnection = cn
rst.CursorType = adOpenDynamic
rst.LockType = adLockOptimistic
rst.Open openDB '
Dim i, n As Integer
i = rst.Fields.Count - 1
Debug.Print "I="; i
For n = 0 To i
Debug.Print CStr(rst.Fields(n).Name)
xListView.ColumnHeaders.Add , , CStr(rst.Fields(n).Name)
Next n
Dim ItmX As ListItem
Dim intx As Integer
For intx = 1 To 1 '做50次循环的目标是得到更多的数据,花更多的时间,其他没有意义
rst.MoveFirst
Do Until rst.EOF
Set ItmX = xListView.ListItems.Add()
' ItmX.Icon = 1
' ItmX.SmallIcon = 1
ItmX.Text = rst.Fields(0).Value
For n = 1 To i
ItmX.SubItems(n) = Nz(rst.Fields(n).Value)
Next n
intNow = intNow + 1
xListView.Requery
rst.MoveNext
Loop
Next intx
ListView.View = lvwReport
Debug.Print xListView.ListItems.Count()
End Sub |
|