Hi
I think I am having trouble with the Fetchall property.
I have set the Fetchall to False and FetchRows to 100.
I have counted number of records in the table beforehand with a select Count(*).
With this:
Progressbar.max := queryCount.Fields[0].asInteger
MSQuery1.open;
while not MSQuery.eof do
begin
advanceProgressBar
Do something with result
MSQuery.next
end
it seems to me, that all records are fetched before I start traversing the dataset.
What I want to acheive is:
- Get the first 100 records
- Start traversing them, handling the values
- Update a progressbar
- Get the next 100 records as needed....
I have been searching the forum for answers on this but couldnt find any. I did however stumble on someone asking how to stop fetching once 500 records are retreived... In addition to above question, how do I figure out when 500 records are retreived?
Kind regards
Jens Fudge
Trouble with Fetchall
My bad
Hi again
It seems it was me that momentarily switched my brain of.
The SQL I sent to the server in fact only resultet in 150 records, which is why it seemd to me, that the retreival of the records was done before updating the progress bar.
The SQL was heavy, and due to something I have to explore, it took a long time. So what I experienced was:
Press the button that opens the query
Wait a long time for the server to finish
Retreive the records in a split second
Thanks for such cool DB-components
Oh, and I figured out that recordCount in a AfterFetch returned how many records was fetched so far..
Kind Regards
Jens Fudge
It seems it was me that momentarily switched my brain of.
The SQL I sent to the server in fact only resultet in 150 records, which is why it seemd to me, that the retreival of the records was done before updating the progress bar.
The SQL was heavy, and due to something I have to explore, it took a long time. So what I experienced was:
Press the button that opens the query
Wait a long time for the server to finish
Retreive the records in a split second
Thanks for such cool DB-components
Oh, and I figured out that recordCount in a AfterFetch returned how many records was fetched so far..
Kind Regards
Jens Fudge
-
AndreyZ