Browse Source

Update blueCopy

pull/12/MERGE
skx 4 years ago
parent
commit
bd8f269caf
  1. 10
      Src/Asp.Net/SqlSugar/Realization/SqlServer/SqlBuilder/SqlServerBlueCopy.cs

10
Src/Asp.Net/SqlSugar/Realization/SqlServer/SqlBuilder/SqlServerBlueCopy.cs

@ -51,7 +51,15 @@ namespace SqlSugar
{
this.Context.Ado.Connection.Open();
}
bulkCopy.WriteToServer(dt);
try
{
bulkCopy.WriteToServer(dt);
}
catch (Exception ex)
{
this.Context.Ado.Connection.Close();
throw ex;
}
if (this.Context.CurrentConnectionConfig.IsAutoCloseConnection && this.Context.Ado.Transaction == null)
{
this.Context.Ado.Connection.Close();

Loading…
Cancel
Save