Subject | Re: [IBO] IB_Query Ordering Problems |
---|---|
Author | kj01135 |
Post date | 2003-05-13T16:56:19Z |
Hmmm.., I saw this before on other thread. Does it have to use at
OnPrepareSQL event? Or It can be used at any place and refresh the
dataset automatically?
Based on what it said in GSG. I can use SQLOrder to add sorting
criteria at runtime. My code look like this:
procedure TDMItems.qryItemPrepareSQL(Sender: TIB_Statement);
begin
with qryItem do
begin
SQLOrder.Add('LOC_SHOP');
SQLOrder.Add('ITEMCODE');
end;
end;
qryItem's SQL is "select * from items;"
When I look at the SQL Monitor, it shows:
select * from items
LOC_SHOP;
which of course give an Invalid Token error as there is no Order By
in it. In the GSG example, it also use SQLWhereItems before
SQLOrder. So it makes me wonders whether SQLOrder can only be used
with SQLWhereItems. I am getting confuse.
Thanks for your help Paul.
Regards,
Kenneth Man
OnPrepareSQL event? Or It can be used at any place and refresh the
dataset automatically?
Based on what it said in GSG. I can use SQLOrder to add sorting
criteria at runtime. My code look like this:
procedure TDMItems.qryItemPrepareSQL(Sender: TIB_Statement);
begin
with qryItem do
begin
SQLOrder.Add('LOC_SHOP');
SQLOrder.Add('ITEMCODE');
end;
end;
qryItem's SQL is "select * from items;"
When I look at the SQL Monitor, it shows:
select * from items
LOC_SHOP;
which of course give an Invalid Token error as there is no Order By
in it. In the GSG example, it also use SQLWhereItems before
SQLOrder. So it makes me wonders whether SQLOrder can only be used
with SQLWhereItems. I am getting confuse.
Thanks for your help Paul.
Regards,
Kenneth Man
> The SQLWhereItems are a lot different from the other SQLxxxproperties.
>entire
> Properties like SQLOrder, SQLWhere, SQLHaving etc. contain the
> clause including the keyword. So you have to set SQLOrder likethis:
>other
> MyQuery.SQLOrder.Text := 'ORDER BY ARTNO, SIZE, PRICE';
>
> or in BCB (don't remember what you use, yesterday's messages on
> OS ;-)) :
>
> MyQuery->SQLOrder->Text = "ORDER BY ARTNO, SIZE, PRICE";
>
>
> HTH,
> Paul Vinkenoog