Subject Dynamically generated SQL with TIBOQuery
Author Brian Dunstan
I have encountered a problem with one of the forms I have converted from BDE
-> IBO.

The form allows the sort order of a grid to be changed at runtime. The
IBOQuery is closed, the last line of SQL (which has the ORDER by clause) is
deleted from IBOQuery.SQL and a new ORDER BY clause is added and the query
opened again.

That worked fine with TQuery. But it does not work with TIBOQuery.

When I look at what is happening with the monitor I find that the original
ORDER BY is not deleted from the statement before it is prepared, so an SQL
error results. In other words, the statement being sent to the server is not
the same as the statement in IBOQuery.SQL. Why?

It appears that IBO is trying to do something smart with the ORDER BY but is
getting it wrong.

Any assistance would be greatly appreciated,

Thanks,

Brian