My code times out on the ExecuteNonQuery line below. I don’t know why. I’ve increased the timeout to 900 and it still times out.
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();
}
}
Since this is a bulk activity, which I imagine is updating many many rows, it’s probably legitimately taking that long. Try setting the timeout to
0for “No timeout” and see if it will complete.