Subject | BeforeOpen, refresh and params |
---|---|
Author | Marco Menardi |
Post date | 2002-11-09T02:02:13Z |
I use IB_Query, and I've read that the best place to put params assigmnent is in the BeforeOpen event, since it's called by Open (of course) but also by Refresh.
Well, this seems not the case...
This sequence:
with MyQuery do
begin
InvalidateSQL;
if Active then Refresh else Open;
end;
does always fire PrepareSQL (see InvalidateSQL), but if the query is active, and so the refresh is executed, BeforeOpeen is not fired!
Is it a recent bug of IBO, my misunderstanding, an error in a Helen's reply (msg #17528 about IBOQuery, but should it be valid for IB_Query as well?)?
What is please the correct sequence of istructions, and the right event handler inside which put parameter assignment, if I want to "refresh" the query using new param values?
And when I need InvalidateSQL in addition to param assignment, what are the steps instead?
In samples and posts I've found the most wide sequence... someone closes and opens the query every time, someone else unprepares it and then reprepares, etc., but I would like to minimize server work, so if a query can stay prepared, I would like not to unprepare it, and if it can stay open, I just want to refresh it... (ok, you've got the idea ;)
Thanks a lot
A complitely lost Marco Menardi
Well, this seems not the case...
This sequence:
with MyQuery do
begin
InvalidateSQL;
if Active then Refresh else Open;
end;
does always fire PrepareSQL (see InvalidateSQL), but if the query is active, and so the refresh is executed, BeforeOpeen is not fired!
Is it a recent bug of IBO, my misunderstanding, an error in a Helen's reply (msg #17528 about IBOQuery, but should it be valid for IB_Query as well?)?
What is please the correct sequence of istructions, and the right event handler inside which put parameter assignment, if I want to "refresh" the query using new param values?
And when I need InvalidateSQL in addition to param assignment, what are the steps instead?
In samples and posts I've found the most wide sequence... someone closes and opens the query every time, someone else unprepares it and then reprepares, etc., but I would like to minimize server work, so if a query can stay prepared, I would like not to unprepare it, and if it can stay open, I just want to refresh it... (ok, you've got the idea ;)
Thanks a lot
A complitely lost Marco Menardi