Re: ... after Opening a record set
From: Al Reid (areidjr_at_reidDASHhome.com)
Date: 06/28/04
- Next message: Michael Keating: "Re: handling error when Open fails"
- Previous message: Allcomp: "Re: ... after Opening a record set"
- In reply to: Allcomp: "Re: ... after Opening a record set"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 28 Jun 2004 08:23:16 -0400
Marc,
Again, I will point out that as long as one can live with a client cursor (all records retrieved to the client machine during the
Recordset Open) then you are correct. However, if one wants or needs to use a client side cursor then, in my opinion, it is safer
(and mandatory for a forward only cursor) to loop using EOF.
For most applications, it is better to loop based on EOF unless there is a compelling reason to do otherwise. You apparently have a
situation where it is desirable to fetch all records locally before processing AND speed (about 16% faster) is a concern. However,
with a Client side cursor, the open statement is almost instantaneous and the records are only retrieved as needed. This can result
in a performance benefit and the program can remain responsive while records are being retrieved.
I think that the OP now has a clearer understanding of the trade-offs.
-- Al Reid "It ain't what you don't know that gets you into trouble. It's what you know for sure that just ain't so." --- Mark Twain "Allcomp" <fa097770@nospam.skynet.be> wrote in message news:40dfbe6b$0$9758$a0ced6e1@news.skynet.be... > Hello, > > I have seen a mistake sometimes depending on the recordset's option. > To solve that, I make > with Recordset > If .Recordcount > 0 then > .movelast > .Movefirst > for i = 1 to .Recordcount > .... > .... > ... > next i > endif > .Close > I have made a program that must import millons record from multiple tables, > and convert them... > I am 20 to 30% faster by doing the .movelast, .movefirst and .Recordcount > than by using the .EOF. > You must know that the .EOF is a method that is launched every time. The > .movelast, .Movefirst and .Recordcount is one time 3 methods. and after that > only numbers are compared instead of a method .EOF > It is the same with MSDE and Sybase (speed and correct recordcount), record > on server or client > > Marc Allard > Allcomp > > "Al Reid" <areidjr@reidDASHhome.com> a écrit dans le message de > news:OGwP1MqWEHA.2576@TK2MSFTNGP10.phx.gbl... > > > > "Allcomp" <fa097770@nospam.skynet.be> wrote in message > news:eyJaL2nWEHA.4032@TK2MSFTNGP11.phx.gbl... > > > Hello, > > > > > > It is also possible to use Recordset.Recordcount > > > It will say the number of records returned by the recordset. > > > > > > After opening a recordser, I always make for i = 1 to rs.Recordcount. > > > > > > > It is not a reliable method of retrieving records from a recordset. Yes, > It may work for you with MS Access and Cursor location of > > adUseClient, but other than that, one is asking for trouble. Looping thru > the recordset while EOF is False will always work. > > -- > > Al Reid > > > > "It ain't what you don't know that gets you into trouble. It's what you > know > > for sure that just ain't so." --- Mark Twain > > > > > > > > > > Marc Allard > > > > > > > > > "Dale" <dale0610@hotmail.com> a écrit dans le message de > > > news:u9ImoEhWEHA.2972@TK2MSFTNGP12.phx.gbl... > > > > Thanks guys, I have seen different methods used including the .EOF. I > > > > have just cut n' pasted which code from other parts of the program. > If > > > > testing for .EOF is the best way of doing it, I'll use this method. > > > > Thanks again. > > > > > > > > > > > >
- Next message: Michael Keating: "Re: handling error when Open fails"
- Previous message: Allcomp: "Re: ... after Opening a record set"
- In reply to: Allcomp: "Re: ... after Opening a record set"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|