超时已过期。操作完成之前经过的超时时间或服务器没有响应。该语句已终止。 [英] Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. The statement has been terminated.
本文介绍了超时已过期。操作完成之前经过的超时时间或服务器没有响应。该语句已终止。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
protected void SaveAttachements(Int64 noticeDetailID)
{
try
{
if (gvAttachments.Rows.Count > 0)
{
String Sql = string.Empty;
if ((Session["FileDetail"].ToString() !=""))
{
string[] Records = Session["FileDetail"].ToString().Split('#');
for (int i = 0; i < Records.Length; i++)
{
string[] arrRecords = Records[i].Split(',');
cmd = new SqlCommand();
cmd.CommandText = "select File_Name,File_Format,File_Content from Temporary_Attachment Where File_ID='" + arrRecords[1] + "'";
cmd.CommandType = CommandType.Text;
cmd.Connection = con;
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
cmd = new SqlCommand();
Sql = "Insert into Notice_Attachment(File_Name,File_Format,File_Content,Notice_Detail_ID) values ('" + dr["File_Name"].ToString() + "','" + dr["File_Format"].ToString() + "',(Select top(1) File_Content from Temporary_Attachment Where File_ID='" + arrRecords[1] + "')," + noticeDetailID + ")";
cmd.CommandText = Sql;
cmd.CommandType = CommandType.Text;
cmd.Connection = con;
cmd.ExecuteNonQuery();
Sql = "Delete from Temporary_Attachment Where File_ID='" + arrRecords[1] + "'";
cmd.CommandText = Sql;
cmd.CommandType = CommandType.Text;
cmd.Connection = con;
cmd.ExecuteNonQuery();
}
}
}
}
}
catch (Exception ex)
{
}
}
请帮助??
Please Help??
推荐答案
尝试增加时间:
Try increasing time out by:
cmd.TimeOut=180;
这篇关于超时已过期。操作完成之前经过的超时时间或服务器没有响应。该语句已终止。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文