SqlCommand对象,什么时间进行的CommandTimeout长度是多少?

编程入门 行业动态 更新时间:2024-10-20 21:00:13
本文介绍了SqlCommand对象,什么时间进行的CommandTimeout长度是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我如何决定什么时间作为超时使用长度使用SqlCommand对象时?

How do I decide what length of time to use as a timeout when using an SqlCommand object?

在的code我的工作零件(写别人)我有:

On parts of the code I'm working on (written by somebody else) I have:

cmd.CommandTimeout = 60;

我认为这是相当短。但是,我看到一些人在论坛上谈论它设置为30000,这似乎太长了。

Which I think is quite short. However, I have seen some people in forums talking about setting it to 30000, which seems too long.

我怎么知道什么是最适合我的应用?

How do I know what is best for my application?

推荐答案

人们似乎都搞不清楚,这是否是秒或毫秒。该documentation指出,超时以秒为单位。 1分钟超时似乎是合理的大多数查询。一个8+小时超时的不的似乎是合理的。

It seems that people are confused as to whether this is seconds or milliseconds. The documentation states that the timeout is in seconds. A 1-minute timeout seems reasonable for most queries. An 8+ hour timeout doesn't seem reasonable.

你有你期待拿一分钟长的查询?如果是这样,将其抬高,您预计会比任何你会看到,如果一切工作正常高值,但不会高到采取永远提醒您注意的一个问题。 (例如,你可能会去从1分钟到5分钟。)

Do you have queries you're expecting to take longer than a minute? If so, raise it to a value you expect to be higher than anything you'd see if everything is working properly, but not so high as to take forever to alert you to a problem. (For example, you might go from 1 minute to 5 minutes.)

更多推荐

SqlCommand对象,什么时间进行的CommandTimeout长度是多少?

本文发布于:2023-11-25 15:33:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1630318.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:长度   对象   时间   SqlCommand   CommandTimeout

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!