SqlCommand.CommandTimeout和SqlConnection.ConnectionTimeout之间的区别是什么? [英] What is the difference between SqlCommand.CommandTimeout and SqlConnection.ConnectionTimeout?

查看:305
本文介绍了SqlCommand.CommandTimeout和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是多长一个命令可以完成。 <一href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectiontimeout.aspx"><$c$c>ConnectionTimeout是多久可以采取建立到服务器的连接开始。

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆