Re: Deadly slow code ... where am I screwing up
From: Val Mazur (group51a_at_hotmail.com)
Date: 06/02/04
- Next message: Val Mazur: "Re: Clipper and ADO"
- Previous message: Brad H McCollum: "UpdateBatch or Update w/Stored Procedure (Database via Wireless Network)"
- In reply to: Dale: "Deadly slow code ... where am I screwing up"
- Next in thread: Dale: "Re: Deadly slow code ... where am I screwing up"
- Reply: Dale: "Re: Deadly slow code ... where am I screwing up"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 2 Jun 2004 18:34:36 -0400
Hi Dale,
It is probably slow when you open recordset. Right?
Two suggestions. First open your recordset as read-only, forward-only. It
would improve performance significantly. Since you do not need to edit
anything in a recordset, it will be the best option. Second, check if you
have an index in a database for the upc field. If not, then process will be
slow, because database engine will spend most of the time to sort the data.
If you create index, then it should be pretty fast unless you select huge
amount of records and it would take some time to transfer data over network.
--
Val Mazur
Microsoft MVP
"Dale" <dale0610@hotmail.com> wrote in message
news:%23ZvRedMSEHA.2000@TK2MSFTNGP11.phx.gbl...
> Hi all, I'm trying to load two fields from a table into a listview - I
> have the following code in the form's load event and it's deadly slow
> popping up. What's the best way to populate a listview with table
> columns? Thanks.
>
>
> Dim itmx As ListItem
> Dim sSelect As String
>
> lvProducts.ListItems.Clear
>
> Set rsProducts = New ADODB.Recordset
>
> rsProducts.Open "SELECT upc, description FROM PRODUCTS ORDER BY upc",
> cnn, adOpenStatic, adLockPessimistic
>
>
> rsProducts.MoveFirst
>
> While rsProducts.EOF = False
> Set itmx = lvProducts.ListItems.Add(, ,
> rsProducts.Fields.Item("upc").Value)
> itmx.SubItems(1) = rsProducts.Fields.Item("description").Value
>
> rsProducts.MoveNext
> Wend
>
> rsProducts.Close
>
> lvProducts.View = lvwReport
- Next message: Val Mazur: "Re: Clipper and ADO"
- Previous message: Brad H McCollum: "UpdateBatch or Update w/Stored Procedure (Database via Wireless Network)"
- In reply to: Dale: "Deadly slow code ... where am I screwing up"
- Next in thread: Dale: "Re: Deadly slow code ... where am I screwing up"
- Reply: Dale: "Re: Deadly slow code ... where am I screwing up"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|