I have a listview in VB6 that is loading about 5000 items and it is taking 10-15 seconds. I load it from a SQL stored Proc. When I exec the sp from query analizer it returns almost instantly. Any thought on speed ?
sortCMD = "EXEC LB_Inventory_V"
Dim db As Connection
Set db = New Connection
db.CursorLocation = adUseClient
db.Open sADOConnect
Set RS = New Recordset
RS.Open sortCMD, db, adOpenStatic, adLockOptimistic
Dim mItem As Variant
Dim lx As Long
Dim strItem As String
Dim STRA As String
Dim STRB As String
Dim Refreshed As Boolean
With List
.ListItems.Clear
.Sorted = False
If RS.RecordCount > 0 Then RS.MoveFirst
Do Until RS.EOF
STRA = .ColumnHeaders(1)
strItem = RS!ITEMNMBR
'Add the item
Set mItem = .ListItems.Add(, , strItem)
'Do the subitems
mItem.SubItems(1) = RS!ITEMDESC
mItem.SubItems(2) = RS!VENDORID
mItem.SubItems(3) = RS!VNDITNUM
mItem.SubItems(4) = RS!USCATVLS_1
mItem.SubItems(5) = RS!USCATVLS_6
mItem.SubItems(6) = RS!LISTPRICE
mItem.SubItems(7) = RS!LOCNCODE
mItem.SubItems(8) = RS!QTYONHND
RS.MoveNext '
lx = lx + 1
Loop
RS.MoveFirst
List.ListItems(1).EnsureVisible
.Refresh
End With
AddToList = True
Thanks,
sortCMD = "EXEC LB_Inventory_V"
Dim db As Connection
Set db = New Connection
db.CursorLocation = adUseClient
db.Open sADOConnect
Set RS = New Recordset
RS.Open sortCMD, db, adOpenStatic, adLockOptimistic
Dim mItem As Variant
Dim lx As Long
Dim strItem As String
Dim STRA As String
Dim STRB As String
Dim Refreshed As Boolean
With List
.ListItems.Clear
.Sorted = False
If RS.RecordCount > 0 Then RS.MoveFirst
Do Until RS.EOF
STRA = .ColumnHeaders(1)
strItem = RS!ITEMNMBR
'Add the item
Set mItem = .ListItems.Add(, , strItem)
'Do the subitems
mItem.SubItems(1) = RS!ITEMDESC
mItem.SubItems(2) = RS!VENDORID
mItem.SubItems(3) = RS!VNDITNUM
mItem.SubItems(4) = RS!USCATVLS_1
mItem.SubItems(5) = RS!USCATVLS_6
mItem.SubItems(6) = RS!LISTPRICE
mItem.SubItems(7) = RS!LOCNCODE
mItem.SubItems(8) = RS!QTYONHND
RS.MoveNext '
lx = lx + 1
Loop
RS.MoveFirst
List.ListItems(1).EnsureVisible
.Refresh
End With
AddToList = True
Thanks,