我的代码在下面的ExecuteNonQuery行中超时。我不知道为什么。我已将超时时间增加到900,但仍然超时。
using (var conn = new SqlConnection(localConnection))
{
var command = String.Format(@"UPDATE dbo.Documents SET DocFile = {0} WHERE ID = '{1}'", @"BulkColumn from Openrowset(Bulk 'C:\Work\Document.docx', Single_Blob) AS DocFile", projID);
using (var sqlWrite = new SqlCommand(command, conn))
{
conn.Open();
sqlWrite.Parameters.Add("@File", SqlDbType.VarBinary, file.Length).Value = file;
sqlWrite.ExecuteNonQuery();
}
}
答案 0 :(得分:2)
由于这是一个批量活动,我想这会更新许多行,因此可能合法地花费这么长时间。尝试将超时设置为0
为“无超时”并查看是否完成。