Subject Re: [IBO] AssignSQLWithSearch don't accept parameters
Author Helen Borrie
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;

>> with QIBO do

etc.

HB