求解SQL查询超时错误 [英] Solving a timeout error for SQL query
本文介绍了求解SQL查询超时错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我得到这个错误:
超时过期。之前,完成上述操作超时时间已过或服务器没有响应。
块引用>
我知道目前已经有导游在那里帮助解决这个问题,但他们没有为我工作。我在想什么或应该在哪里我在C#程序中的代码添加到这些SQL语句:
SQL字符串= project1.Properties .Resources.myQueryData;
SqlDataAdapter的sqlClearQuestDefects =新SqlDataAdapter的(SQL,
数据源= AB;初始目录=交流电;用户ID =广告;密码= AA);
的DataSet lPlanViewData =新的DataSet();
sqlClearQuestDefects.Fill(lPlanViewDataPlanViewData);
我收到超时错误在这行:
SqlDataAdapter的sqlClearQuestDefects =新SqlDataAdapter的(SQL,
数据源= AB;初始目录=交流电;用户ID =广告;密码= AA);
解决方案SqlDataAdapter的ADP =新SqlDataAdapter的();
adp.SelectCommand.CommandTimeout = 0; //设置超时的Command对象
I am getting this error:
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
I know there are already guides out there to help solve this but they are not working for me. What am I missing or where should I add the code to these SQL statements in my C# program:
String sql = project1.Properties.Resources.myQueryData; SqlDataAdapter sqlClearQuestDefects = new SqlDataAdapter(sql, "Data Source=ab;Initial Catalog=ac;User ID=ad; Password =aa"); DataSet lPlanViewData = new DataSet(); sqlClearQuestDefects.Fill(lPlanViewData, "PlanViewData");
I am getting the timeout error at this line:
SqlDataAdapter sqlClearQuestDefects = new SqlDataAdapter(sql, "Data Source=ab;Initial Catalog=ac;User ID=ad; Password =aa");
解决方案SqlDataAdapter adp = new SqlDataAdapter(); adp.SelectCommand.CommandTimeout = 0; // Set the Time out on the Command Object
这篇关于求解SQL查询超时错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文