Use ibcupdate component to insert/update a lot of records

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
alosak
Posts: 3
Joined: Fri 19 Mar 2010 18:27

Use ibcupdate component to insert/update a lot of records

Post by alosak » Fri 19 Mar 2010 18:37

hi,
I'm new in ibdac components. I'm not able to set parameters for a sql statement.
Below an example:

ibcQuery1.sql.Text:='select * from mytable';


ibcupdatesql1.InsertSQL := 'insert into mytable (field1, field2) values (:par1, :par2)';

How to set par1 and par2 ? I mean something like this :
ibcupdatesql1.SQL[ukInsert].parambyname('par1').asstring := 'valore';

Thanks in advance for any help.

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Mon 22 Mar 2010 13:20

TUniUpdateSQL does not allow using parameters of SQL properties. In order to get access to those parameters you should use the Object properties like InsertObject, UpdateObject, and DeleteObject. You can assign the TUniSQL component to these properties to perform advanced adjustment of the insert/update/delete operations.

Also note: SQLInsert statement can be parameterized queries. If the names of the parameters are the same as those of fields, then values from fields will be set in parameters automatically. Parameters prefixed with OLD_ allow using current values of fields prior to an actual operation.

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Tue 23 Mar 2010 10:52

Also, you can handle the TCustomDADataSet.BeforeUpdateExecute event and set parameters value, like this:

Code: Select all

Params.ParamByName(ParamName).AsString := s;

Post Reply