Home > Back-end >  ADO to connect mysql how to execute multiple SQL statements
ADO to connect mysql how to execute multiple SQL statements

Time:10-04

DbCon. BeginTrans;//transaction
Try
For I:=1 to 10 do
The begin
Q.s ql. Add (' insert into the table values (' + inttostr (I) + ', 'a', 'a'... ) ')
end;
DbCon.Com mitTrans;//to commit the transaction
Except,
On E: the Exception do
The begin
DbCon. RollbackTrans;//rollback
ShowMessage (E.M essage);
End
end;
This code can connect SQL2000 executed correctly
Not a connection MYSQL, measurement, is not to execute multiple, a single execution can
How to write to perform it at the same time,

CodePudding user response:

At the bottom of the similar structure can

INSERT INTO example
VALUES
(100, 'Name' 1 ', 'Value' 1 ', 'Other 1'),
(101, 'Name 2', 'Value' 2 ', 'the Other 2'),
(102, 'Name' 3 ', 'Value' 3 ', 'the Other 3'),
(103, 4 'Name', 'Value' 4 ', 'Other 4');
  • Related