Jan
|
| Posted: 03/13/2002, 1:39 AM |
|
Hi,
Stepping through a recordset goes very slow, while opening and closing the recordset is very fast.
sample:
before show event
>>>
sSQLstring="Select ...."
OpenRS rsOT, sSQLstring
While NOT rsOT.EOF
TextString= TextString & Getvalue(rsOT, "Fieldname")
rsOT.Movenext
wend
rsOT.Close
set rsOT.Nothing
fldDataText=TextString
<<<
Without the while...wend loop this query finishes in <1s. With While...Wend it takes over >5s.
Any idea how to improve performance for stepping through a recordset and fill a string with values?
Regards,
Jan
|
|
|
 |
Alex Alexapolsky
|
| Posted: 03/13/2002, 2:45 AM |
|
Hey , but without while-wend it doesn't perform so many iterations
so while is not a problem , u gotta decide if you need loop at all
|
|
|
 |
Jan
|
| Posted: 03/13/2002, 3:53 AM |
|
Alex,
The result of the query could be empty, or filled with multiple records...
So;
>>
If not rsOT.eof
textString=rsOT.Getstring
endif
rsOT.Close
set rsOT.Nothing
fldDataText=TextString
<<
I'm starting to believe that the .EOF is slow? Is there a better/faster way to check if the recordset is filled (or it can skip 'getstring'?)
Regards,
Jan
|
|
|
 |
SaulMP
|
| Posted: 03/13/2002, 1:08 PM |
|
Cuando el recordset tiene datos, entonces al utilizar un while la instruccion RS.EOF tiene que barrer todos los registro para verificar si hay un EOF, por lo tanto es mas recomendable hacer esto
sSQLstring="Select ...."
OpenRS rsOT, sSQLstring
intLoop =0
if not rsOT.EOF then
intLoop = rsOT.Recordcount
end if
TextString=""
for i=0 to intLoop
rsOT.Bookmark = i
TextString= TextString & Getvalue(rsOT, "Fieldname")
next i
Saludos
saulmp@hotmail.com
|
|
|
 |
|