Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread (ParamByName Field and Data) how to
Thu, Jul 20 2006 7:17 AMPermanent Link

Aaron Taylor
can you use parambyname for both the field and data ?

like

SQL.Add('UPDATE database SET boolfield = True');
SQL.Add('WHERE :ffield LIKE :ffilter');
ParamByName('ffield').AsString:='MyField';
ParamByName('ffilter').AsString:='hello';
ExecSQL;
Thu, Jul 20 2006 8:21 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Aaron,

<< can you use parambyname for both the field and data ? >>

Unfortunately, no.  The best way to remember this is to think of parameters
as being the same as constant values.

--
Tim Young
Elevate Software
www.elevatesoft.com

Wed, Jul 26 2006 5:04 PMPermanent Link

adam
Aaron,

When I want to do this I write the SQL with %s and use the FormatString routine of Delphi
... it works wonderfully

i.e.

SELECT ID, %s, %s FROM Customer WHERE AddressCity = "London"

Could be the SQL

I have a TDBISAMQuery decendent with a "ReplaceStringParams" method. I can call this to
shunt values into the SQL. Note that this even allows dynamic changing of TableNames, or
of parameters within IF statements within the SQL. I find it really useful.

Adam

Image