Subject Re: [IBO] SQL Help
Author Helen Borrie
At 04:18 PM 28-03-01 -0800, you wrote:
>Hi all
>Would someone please know why I cannot retreive the proper records in this
>query?Date is no problem but notetype is?

You don't need to Unprepare for SELECT queries but, if you do, ParamByName will detect an unprepared statement and prepare it for you. In any case, the new parameter values have to be assigned to a dataset that is *already* prepared...

Change handler code to

begin
if Active then Close;
ParamByName('date').asdate := wwDBDateTimePicker1.date;
Open;
end;

>SQL IBOquery1:
>select * from notesdata
>where notedate = :date
>and notetype = 'D'
>order by notedate descending, notetime descending

Why are you ordering by notedate descending, when all of the output has only one date?


>it does retrieve for the proper day but not the notetype, retreives all
>notetypes????

Suggestions (after fixing the parameter assignment problem) :

1. Are your KeyLinks correct?

2. Do you have a Datasource property on this query that might be interfering with your query parameters? Drop a TIB_MonitorDialog on your form and inspect the statement that is being sent to the server. Paste the relevant output back here to the list.

3. If you have eliminated key problems and the problem persists, paste your SQL into the Cursor window of IB_WISQL and run it to see if you get the output you are expecting.

Cheers,
Helen


All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________