SqlCommand.CommandTimeout和SqlConnection.ConnectionTimeout之间的区别是什么? [英] What is the difference between SqlCommand.CommandTimeout and SqlConnection.ConnectionTimeout?
问题描述
有 SqlCommand.CommandTimeout
和.NET SqlConnection.ConnectionTimeout
之间有什么区别?
Is there any difference between SqlCommand.CommandTimeout
and SqlConnection.ConnectionTimeout
in .NET?
推荐答案
是的。 <一href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.commandtimeout.aspx"><$c$c>CommandTimeout$c$c>是多长一个命令可以完成。 <一href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectiontimeout.aspx"><$c$c>ConnectionTimeout$c$c>是多久可以采取建立到服务器的连接开始。
Yes. CommandTimeout
is how long a single command can take to complete. ConnectionTimeout
is how long it can take to establish a connection to the server to start with.
例如,您可能执行比较长时间运行的查询 - 这是完全没问题的他们需要10分钟才能完成,但如果花了10分钟,以开始与连接,你会知道什么是厉害错了。
For instance, you may be executing relatively long-running queries - it's perfectly okay for them to take 10 minutes to complete, but if it took 10 minutes to make the connection to start with, you'd know that something was badly wrong.
这篇关于SqlCommand.CommandTimeout和SqlConnection.ConnectionTimeout之间的区别是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!