Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExecuteSqlBulkCopy带上事务报错 #962

Closed
bao2314483 opened this issue Dec 15, 2021 · 2 comments
Closed

ExecuteSqlBulkCopy带上事务报错 #962

bao2314483 opened this issue Dec 15, 2021 · 2 comments

Comments

@bao2314483
Copy link

Fsql.Transaction(() =>
            {
                //全部清除
                Fsql.Delete<SysHrOrgnization>().Where("1=1").ExecuteAffrows();
                //创建
                Fsql.Insert(data).ExecuteSqlBulkCopy();
            });

提示报错如下:
Microsoft.Data.SqlClient.SqlException: 'Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
The statement has been terminated.'

@luoyunchong
Copy link
Collaborator

luoyunchong commented Dec 15, 2021

目前需要这样使用。

Fsql.Transaction(() =>
{
      //全部清除
     Fsql.Delete<SysHrOrgnization>().Where("1=1").ExecuteAffrows();
     //创建
     Fsql.Insert(data).WithTransaction(Fsql.Ado.TransactionCurrentThread).ExecuteSqlBulkCopy();
});

@bao2314483
Copy link
Author

目前需要这样使用。

Fsql.Transaction(() =>
{
      //全部清除
     Fsql.Delete<SysHrOrgnization>().Where("1=1").ExecuteAffrows();
     //创建
     Fsql.Insert(data).WithTransaction(Fsql.Ado.TransactionCurrentThread).ExecuteSqlBulkCopy();
});

感谢大佬解答

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants