Subject | SQLWhereItems.Add only inside OnPrepare? |
---|---|
Author | mmenaz@lycosmail.com |
Post date | 2001-03-24T17:32:35Z |
Hi, I'm using SQLWhereItems to change query conditions at runtime.
After some experiments, I've found that the only place where put the
SQLWhereItems.Add('condition') is in the OnPrepare event of the query.
So my program has a button that, once pressed, does:
InvalidateSQL;
Refresh;
First;
and in the OnPrepare are set the query SQL conditions.
It would useful to me if, instead, would be possible to set these
conditions outside the OnPrepare, so I could have, for instance, 3
buttons with different conditions, or programmatically use different
conditions in the program flow without the need of a global variable
to make OnPrepare aware of what condition I need. Is it possible? I
mean something like:
Button1.Click()
begin
InvalidateSQL;
SQLWhereItems.Add('condition1')
SQLWhereItems.Add('condition2')
Refresh;
First;
end;
Thanks
Marco Menardi
After some experiments, I've found that the only place where put the
SQLWhereItems.Add('condition') is in the OnPrepare event of the query.
So my program has a button that, once pressed, does:
InvalidateSQL;
Refresh;
First;
and in the OnPrepare are set the query SQL conditions.
It would useful to me if, instead, would be possible to set these
conditions outside the OnPrepare, so I could have, for instance, 3
buttons with different conditions, or programmatically use different
conditions in the program flow without the need of a global variable
to make OnPrepare aware of what condition I need. Is it possible? I
mean something like:
Button1.Click()
begin
InvalidateSQL;
SQLWhereItems.Add('condition1')
SQLWhereItems.Add('condition2')
Refresh;
First;
end;
Thanks
Marco Menardi