Subject Re: [IBO] TIBOQuery, Locate, Order By
Author Lester Caine
asbjorn_fridberg wrote:

> Using a TIBOQuery (IBO Version 4.5.Ai, Delphi 7) I am experiencing
> the following problem:
> When the querys' SQL includes an 'ORDER BY' statement, I get an
> error when trying to Locate a record in the query, with the Locate
> (const KeyFields: string; const KeyValues: Variant; Options:
> TLocateOptions) function.
>
> I get the following error: '....Dynamic SQL Error SQL error code = -
> 104 Token unknown - line 3 char 18 WHERE....' However, there is
> no 'where' in my sql statement, and the problem disappears if I
> erase the 'ORDER BY' clause from the querys' sql. I have worked
> around
> this by dynamically changing the sql before doing a locate, and then
> changing it back again, but I would appreciate if anyone has a
> suggestion as to what the problem is, and/or how to solve it.

The problem you have is that IBO implements a lot of facilities by
modifying the SQL. For example, using a WHERE field = 'locate' to get
the right value. Since your SQL does not have it's own WHERE, IBO adds
it, and that is after the ORDER BY. All you need is a clean WHERE clause
that IBO can modify, even if it does not actually filter the results.
The WHERE clause is also modified to handle the selective filtering and
things like that.

--
Lester Caine
-----------------------------
L.S.Caine Electronic Services