![](/img/trans.png)
[英]System.Data.SqlClient.SqlException (The wait operation timed out) when debugging only
[英]SqlClient.SqlException: The wait operation timed out
我目前正在尝试使用类似于以下代码的大量插入语句来创建大量测试数据...
using (var connection = new SqlConnection(_connectionString))
{
using (var command = new SqlCommand(query.ToString(), connection))
{
try
{
connection.Open();
command.ExecuteNonQuery();
return true;
}
catch (Exception e)
{
......
}
}
}
我的问题是我不断出错
等待操作超时
但是,当我在SQL Server Management Studio中运行失败的SQL语句时,它的执行时间不到100毫秒。 插入当前最大的表(当前有47,738,476行,大小为1,970,696Kb)时,似乎总是会发生该错误。
我正在使用:
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)
非常感激任何的帮助。
免责声明:可能不是答案,但可以解决问题:)
使用Redgate Sql数据生成器
http://www.red-gate.com/products/sql-development/sql-data-generator/
它不是免费的,但是经过几天的全功能试用,它将为您完成我想要的工作。
它有很多选择,并可以生成真实的数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.