小编典典

解决SQL查询超时错误

sql

我收到此错误:

超时时间已到。在操作完成之前超时时间已过,或者服务器没有响应。

我知道那里已经有帮助解决此问题的指南,但它们对我不起作用。我缺少什么,或者应该在哪里将代码添加到C#程序中的这些SQL语句中:

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");

我在此行收到超时错误:

SqlDataAdapter sqlClearQuestDefects = new SqlDataAdapter(sql, 
    "Data Source=ab;Initial Catalog=ac;User ID=ad; Password =aa");

阅读 113

收藏
2021-03-10

共1个答案

小编典典

SqlDataAdapter adp = new SqlDataAdapter();
adp.SelectCommand.CommandTimeout = 0;  // Set the Time out on the Command Object
2021-03-10