Closed zhanfuzhi closed 5 years ago
How to batch two tables at the same time
using (var connection = new SqlConnection(connectionString)) { connection.Open();
// BulkInsert using (var bulk = new BulkOperation<Task01Rec>(connection)) { bulk.DestinationTableName = "Task_01_Rec_History"; bulk.AutoMapOutputDirection = false; // performance can be improved with options bulk.BulkInsert(tasklist.ToList<Task01Rec>()); bulk.BulkDelete(systasklist.ToList<sysTask>()); } }
Hello @zhanfuzhi ,
You currently cannot, you need to use a transaction if you want both be committed at the same time.
Let me know if that answer correctly to your question.
Best Regards,
Jonathan
How to batch two tables at the same time
using (var connection = new SqlConnection(connectionString)) { connection.Open();