Subject Re: [IBO] Parameter looses value on reorder
Author Helen Borrie
At 12:55 PM 09-11-02 +0100, you wrote:
> > OK, now, this will be OK as long as you don't *next* change the ordering,
> > since the query is at this point prepared.
> >
> > However...
> > as soon as you change the ordering, the dataset is unprepared; so the
>next
> > thing to try is to add the assignment to the OnPrepareSQL event
> > handler. Are you with me so far...?
>
>Not a problem so far, but....
>When I put the same assignment into the OnPrepareSQL event and start the
>applicaiton I get an error message "Fieldname: Datum not found".

:-) I thought that might be the case, after I sent that off...until the
query is again in a Prepared state, of course the Parameters are not known.

Now, this time, let's move that assignment statement to the BeforeOpen
event and do the following in OnPrepareSQL (just for testing purposes):

Showmessage(DM.qryBestell.SQLWhereItems.Text);

We want to look at the clause containing the parameter...

If it comes up empty, then you know you need to add the SQLWhereItem back
in there in OnPrepareSQL:
DM.qryBestell.SQLWhereItems.Add('Datum = :Datum');

I have to go to bed now...but I hope by now you're seeing what I think
might be going on here. If you don't have an IB_SQLMonitorDialog running,
drop one on your form and either add a button to call its Show event; or
call its Show event in your FormCreate. (You can disable or remove it
later but it's your best friend when you run into a sequencing problem like
this...)

I hope someone up at your end of the world will step in now and help you to
solve this satisfactorily before the sun comes up here.

Helen