TMyQuery - SQLINSERT

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
lucasbr
Posts: 5
Joined: Fri 22 Sep 2006 00:12

TMyQuery - SQLINSERT

Post by lucasbr » Mon 28 Apr 2008 18:01

Hi,

which SQL commands can i use in SQLINSERT inside of TMYQuery?

Can I use

select max(ordnumber)+1 into @number from order;
insert into order
(number, .......)
values
((select @number), ........)

Can I use TRANSACTION?

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Tue 29 Apr 2008 09:37

Yes you can. You can also use calls to stored procedures in SQLInsert and other properties like this.

Note that the SQLInsert property should hold a command to insert a new record each time you call Insert/Post methods. So you should take care in your script for the provided values to be handled correctly.
If your script must modify either zero or more than one records, you should set the StrictUpdate option of your query to False.

Post Reply