SqlClient.SqlException: timeout

I am currently trying to create a large amount of test data with numerous inserts using code similar to below ...

using (var connection = new SqlConnection(_connectionString))
{
    using (var command = new SqlCommand(query.ToString(), connection))
    {
        try
        {
            connection.Open();

            command.ExecuteNonQuery();

            return true;
        }
        catch (Exception e)
        {
            ......
        }
    }
}

My problem is that I keep getting the error message

Expected Pending Operation

and yet, when I run an SQL statement that failed from SQL Server Management Studio, it runs in less than 100 ms. An error always occurs when pasted into the largest table, which currently has 47,738,476 rows and is 1,970,696Kb.

I use:

Microsoft SQL Server 2012 (SP1) - 11.0.3128.0 (X64) 
Express Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1)

Any help would be most appreciated.

+1
source share
1 answer

Source: https://habr.com/ru/post/1626734/


All Articles