Subject | Re: [IBO] AssignSQLWithSearch don't accept parameters |
---|---|
Author | Helen Borrie |
Post date | 2010-01-21T11:40:05Z |
At 09:48 PM 21/01/2010, you wrote:
QIB.Open;
HB
>Helen wrote:Insert a test to ensure that aValue is what it should be, not an empty string or a string with the wrong character case.
>
>
>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};
>>// Add this statement (sorry I missed it!)
>> QIB.ParamByName('P1').AsString := aValue;
QIB.Open;
>> with QIBO doetc.
HB