首页 新闻 会员 周边

页面访问数据库的时间

0
悬赏园豆:5 [已解决问题] 解决于 2013-05-06 22:15

 默认情况下,页面访问数据库的时间超过一个值,就会返回timeout什么的。怎么这去修改这个时间值?

凡一二三的主页 凡一二三 | 初学一级 | 园豆:85
提问于:2012-11-26 17:03
< >
分享
最佳答案
0

我用的SQlServer 数据库 改下面那个连接超时就可以了 

一般数据库超时 你要看下代码 或者Bll是不是没写好 

收获园豆:5
yellowshorts | 初学一级 |园豆:162 | 2012-11-26 17:48
其他回答(5)
0
using (SqlConnection conn = new SqlConnection())
{
    using (SqlCommand command = new SqlCommand())
    {
        command.CommandTimeout = 25;
    }
}
客家岸田 | 园豆:404 (菜鸟二级) | 2012-11-26 17:51
0

command可以这是的,不知道那个连接字符串是不是也可以设置

www.connectionstrings.com

chenping2008 | 园豆:9836 (大侠五级) | 2012-11-26 21:30
0

修改超时值

若雪封尘 | 园豆:463 (菜鸟二级) | 2012-11-27 09:58
0

connection 会超时,command也会超时

geass.. | 园豆:1821 (小虾三级) | 2012-11-27 20:28
0

web.config 文件中去设置

例<add key="SQLString" value="User id=***;Password=****;Database=*****;Server=localhost;Connect Timeout=50;Max Pool size=200;Min pool Size=5" />

红色背景是等待与服务器的连接的时间(单位秒)

偶不是大叔 | 园豆:140 (初学一级) | 2012-11-28 18:43
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册