使用 ADO.NET 填充数据集时出错 - 超时已过
getting error while filling dataset using ADO.NET - Timeout expired
收到错误提示:
"Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding."
its getting 700 records but taking 45 sec . i think so its the issue.
in this code how to add cmd.CommandTimeout = 60;
我的代码是:
Dap_Proj = new SqlDataAdapter("select LinkId,LinkName,CategoryId, ReportLinks,SubmissionStatus,convert(nvarchar(18),LnkSubmsnDate) as LnkSubmsnDate, convert(nvarchar(18), LnkUpdateDate) as LnkUpdateDate,LnkSubmtdBy,K.KeyWord,RenewalDate from tbl_Link L left join Tbl_keywords K on L.KeywordID=K.KeywordID where
(SubmissionStatus='Approved'or SubmissionStatus='Waiting for Approval') and LnkSubmtdBy='" + Session["LoginUser"].ToString() + "' and Convert(Char(4),LnkSubmsnDate,100) in (select Convert(Char(4),LnkSubmsnDate,100) from tbl_Link )order by case when RenewalDate is null then 1 else 0 end,RenewalDate", connection);
ds = new DataSet();
Dap_Proj.Fill(ds);
要在 sqlDataAdapter 上设置命令超时,试试这个
SqlDataAdapter Dap_Proj = new SqlDataAdapter(strSQLString, conUS);
Dap_Proj .SelectCommand.CommandTimeout=120;
收到错误提示:
"Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding." its getting 700 records but taking 45 sec . i think so its the issue. in this code how to add cmd.CommandTimeout = 60;
我的代码是:
Dap_Proj = new SqlDataAdapter("select LinkId,LinkName,CategoryId, ReportLinks,SubmissionStatus,convert(nvarchar(18),LnkSubmsnDate) as LnkSubmsnDate, convert(nvarchar(18), LnkUpdateDate) as LnkUpdateDate,LnkSubmtdBy,K.KeyWord,RenewalDate from tbl_Link L left join Tbl_keywords K on L.KeywordID=K.KeywordID where
(SubmissionStatus='Approved'or SubmissionStatus='Waiting for Approval') and LnkSubmtdBy='" + Session["LoginUser"].ToString() + "' and Convert(Char(4),LnkSubmsnDate,100) in (select Convert(Char(4),LnkSubmsnDate,100) from tbl_Link )order by case when RenewalDate is null then 1 else 0 end,RenewalDate", connection);
ds = new DataSet();
Dap_Proj.Fill(ds);
要在 sqlDataAdapter 上设置命令超时,试试这个
SqlDataAdapter Dap_Proj = new SqlDataAdapter(strSQLString, conUS);
Dap_Proj .SelectCommand.CommandTimeout=120;