Subject | Re: [IBO] AssignSQLWithSearch don't accept parameters |
---|---|
Author | Arn |
Post date | 2010-01-21T11:53:27Z |
Helen Borrie ha scritto:
I have put a TIB_Query and a TIBOQuery on a form, set up right
properties and so on
All work ONLY if I have no parameters.
However thanks for You time...
Arn
>I already do this with design TIB_Query and TIBOQuery.
>
> At 09:48 PM 21/01/2010, you wrote:
>
> >Helen wrote:
> >
> >
> >Assuming you already have an IB_Connection, MyConnection, and a
> >TIB_Transaction, MyTransaction, with tiConcurrency isolation:
> >>
> >> var
> >> QIB: TIB_Query;
> >> QIBO: TIBOQuery;
> >> aValue: string; // or whatever it has to be
> >> begin
> >> try
> >> QIB := TIB_Query.Create(self);
> >> with QIB do
> >> begin
> >> IB_Connection := MyConnection;
> >> IB_Transaction := MyTransaction;
> >> SQL.Add ('SELECT * FROM TABLE1 WHERE FIELD1 = :P1');
> >> IB_Transaction.StartTransaction;
> >> Prepare;
> >> end;
> >> QIBO := TIBOQuery.Create(self);
> >> with QIBO do
> >> begin
> >> IB_Connection := MyConnection;
> >> IB_Transaction := MyTransaction;
> >> end;
> >>
> >> aValue := {whatever you are doing to get the param value};
>
> Insert a test to ensure that aValue is what it should be, not an empty
> string or a string with the wrong character case.
>
> >>
> >> QIB.ParamByName('P1').AsString := aValue;
>
> // Add this statement (sorry I missed it!)
> QIB.Open;
>
I have put a TIB_Query and a TIBOQuery on a form, set up right
properties and so on
All work ONLY if I have no parameters.
However thanks for You time...
Arn