Subject | Re: [IBO] AssignSQLWithSearch don't accept parameters |
---|---|
Author | Arn |
Post date | 2010-01-21T10:48:57Z |
This is excatly when problem show.
Without Parameters eg: 'SELECT * FROM TABLE1' ----------> WORKS
With Parameters eg: 'SELECT * FROM TABLE1 WHERE FIELD1 = :P1')
-------------> DON'T WORKS
I use ':' or '?' bat is the same....
Helen wrote:
Assuming you already have an IB_Connection, MyConnection, and a
TIB_Transaction, MyTransaction, with tiConcurrency isolation:
Without Parameters eg: 'SELECT * FROM TABLE1' ----------> WORKS
With Parameters eg: 'SELECT * FROM TABLE1 WHERE FIELD1 = :P1')
-------------> DON'T WORKS
I use ':' or '?' bat is the same....
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};
>
> QIB.ParamByName('P1').AsString := aValue;
> with QIBO do
> begin
> AssignSQLWithSearch(QIB);
> Open;
> .... call your reporting procedure
> end;
> finally
> QIBO.Close;
> QIB.Close;
> QIB.Free;
> QIBO.Free;
> end;
>
> Helen
>