Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Clearing parameterised query
Wed, Oct 28 2009 8:37 PMPermanent Link

Peter
Hello

In DBISAM, I used code similar to this to clear a parameter...

      if NOT mData.FieldByName('BankBranch').IsNull then
       AQuery.ParamByName('BranchP').AsString := mData.FieldByName('BankBranch').AsString
      else
       begin
        AQuery.ParamByName('BranchP').DataType := ftString;
        AQuery.ParamByName('BranchP').Clear;
       end;

That code still works in EDB, but is it _necessary_ to include the DataType in EDB? I have used AQuery.ParamByName('BranchP').Clear (without
the begin\end and DataType line), and it works Ok, but I am unsure as to whether or not it is a good idea.

Regards & TIA

Peter
Thu, Oct 29 2009 5:15 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Peter

AFAIK .Clear works on any datatype. If you trace it back you get

procedure TField.Clear;
begin
 if FieldKind in [fkData, fkInternalCalc] then
   SetData(nil);
end;


Roy Lambert [Team Elevate]
Thu, Oct 29 2009 6:53 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Peter,

<< That code still works in EDB, but is it _necessary_ to include the
DataType in EDB? >>

Not after a Prepare, no.  EDB automatically discovers and sets the parameter
data types, whereas DBISAM did not.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image