首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

这是数据库超时的异常吗?为什么?

2012-02-15 
这是数据库超时的错误吗??为什么??传到服务器上之后,有的页面回报错,为:Server Error in / Application.

这是数据库超时的错误吗??为什么??
传到服务器上之后,有的页面回报错,为:
Server Error in '/' Application.
--------------------------------------------

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. 
Source Error: 


Line 77:  
Line 78: string sql3 = "select PictureName From productPicture where ProductID=" + dr[0].ToString().Trim();
Line 79: string url = DataAccess.SqlHelper.ExecuteScalar(conn.constr(), CommandType.Text, sql3).ToString();
Line 80: ((ImageButton)e.Item.FindControl("ImageButton1")).ImageUrl = url;
红色的为错误,
但是页面一旦刷新就正常了
为什么??这是哪里的错误!

[解决办法]
应该是
没有及时释放数据库链接。
所以访问几个页面后,就会出现那个错误。

你可以检查下是否每次使用完数据库后及时关闭了链接。
[解决办法]
可能数据库打开的连接没有关闭,然后超时
[解决办法]
帮顶!
[解决办法]
哦顶, 顶 顶~~~

还是把代码贴上来 看看吧。 现在大家只是猜~
[解决办法]
try
{
conn.open();



}
catch
{
 
}
finally
{
conn.close();

}
[解决办法]
把SqlCommand.CommandTimeout 设置大一点 默认是30秒

SqlCommand.CommandTimeout 和 SqlConnection.ConnectionTimeout 是两个概念

热点排行