Home > database >  To save a few SQL statement as a string for batch operation, can not use the transaction?
To save a few SQL statement as a string for batch operation, can not use the transaction?

Time:03-02

Feel the batch SQL should be implicit transaction, so you don't have affairs can also?

CodePudding user response:

Such as multiple SQL statements into a StringBuilder (c #), and then submit

CodePudding user response:

Can't, you can try it yourself, create the table, insert two data, and see the results

 
CREATE TABLE test (
[content] [NVARCHAR] (3) the NULL
)

[code=csharp]
The StringBuilder strSql=new StringBuilder ();
StrSql. Append (" INSERT INTO dbo. Test (content) VALUES (' 124 ');" );
StrSql. Append (" INSERT INTO dbo. Test (content) VALUES (' 456789 ');" );
  • Related