table name as parameter

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
FerCastro
Posts: 47
Joined: Mon 26 Jun 2006 17:32
Location: México City
Contact:

table name as parameter

Post by FerCastro » Wed 14 Nov 2012 21:28

Hello

Is it possible use a parameter name as table name un a update query object?

Something like.

update
:p_TableName
set
...
...

?

Thanks

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: table name as parameter

Post by AlexP » Thu 15 Nov 2012 08:53

Hello,

You cannot pass table names in parameters, macros can be used for this, for example:

Code: Select all

  UniQuery1.SQL.Text := 'UPDATE &TABLE SET &FIELD = :VALUE';
  UniQuery1.MacroByName('TABLE').AsString := 'MyTable';
  UniQuery1.MacroByName('FIELD').AsString := 'MyField';
  UniQuery1.ParamByName('VALUE').AsString := 'MyValue';
  UniQuery1.Execute;

FerCastro
Posts: 47
Joined: Mon 26 Jun 2006 17:32
Location: México City
Contact:

Re: table name as parameter

Post by FerCastro » Sun 18 Nov 2012 03:57

I will try, thanks a lot

Post Reply