Subject Re: [IBO] Dates in TIBOQuery vs. PrepareSQL
Author Helen Borrie
Tony,

At 03:35 PM 12/10/2005 +0000, Tony Masefield wrote:

>Thanks Alan, missed the two single apostophes vs. the double
>apostrophe. Now working fine. This construct is a little peculiar
>(at least to me).

First, PLEASE TRIM YOUR MESSAGES !!!


As Alan pointed out, doubling is the correct way to escape apostrophes in
Pascal (and in Firebird, as well, as it happens!)

However, relying on date literals in SQL from the client side is not the
recommended way to do this, if it can possibly be avoided. Use parameters
and then, in your "before" event, use AsDate or AsDateTime to assign the date.

viz.

MyDataset.SQLWhereItems.Add('where ADate >= :ADate');

Then (assuming you're using the search in a dataset):

MyDataset.ParamByName('ADate').AsDateTime := YourDateTimeVariable;

Helen