[英]Error: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding
The environments I'm using are: .NET (2.0) and SQL Server 2005. 我使用的环境是:.NET(2.0)和SQL Server 2005。
The scenario: in a .NET form the user gets prompted for two variables that will be provided to a stored procedure in SQL Server. 方案:以.NET形式提示用户输入两个变量,这些变量将提供给SQL Server中的存储过程。 Once the records are returned from the stored procedure, the .NET app will import these records to a
.csv
file. 从存储过程中返回记录后,.NET应用程序会将这些记录导入到
.csv
文件中。
The trick here is that the stored procedure is dynamic. 这里的窍门是存储过程是动态的。 The records returned are not always the same columns or populating the same temp table.
返回的记录并不总是相同的列或填充相同的临时表。 The .NET app works when the stored procedure runs in less than 30 secs.
当存储过程运行少于30秒时,.NET应用程序将运行。
I have increase my conn.CommandTimeout = 6000
in my app and I have increase the "remote query connection" in SQL Server to 6000 as well but it's still failing for those variables running longer then 30 secs. 我在我的应用程序中增加了
conn.CommandTimeout = 6000
,在SQL Server中也将“远程查询连接”也增加到6000,但是对于那些运行时间超过30秒的变量仍然失败。
Any suggestions is greatly appreciated. 任何建议,不胜感激。
Thanks Chaydee 谢谢Chaydee
This could be because you are setting the command timeout on the connection instead of the command object itself. 这可能是因为您是在连接上而不是命令对象本身上设置命令超时。 Can't see your code but if you are using a DataReader, DataAdapter etc. try setting CommandTimeout on those objects.
看不到您的代码,但是如果您使用的是DataReader,DataAdapter等,请尝试在这些对象上设置CommandTimeout。 A few other possibilities:
其他一些可能性:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.