本文介绍了求解SQL查询超时错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到这个错误:



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查询超时错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-13 09:23