Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code英文就不要你们翻译了 别废话SQL连接池问题 求解
我返回的是datatable 是自动释放对象的   
C# code
DataTable table = SqlHelper.ExecuteDataTable(sql, CommandType.StoredProcedure, para)
为什么 还有连接池过大的问题???我找到了规律 页面连续刷新3次以后 当第4次刷新时 就会出现上面错误 

解决方案 »

  1.   

    首先希望大家看清楚 我用的是datatable  而且是连续刷新3次之后 才会出现这个问题
      

  2.   

    不是你返回的datatable自动释放,是你的数据库连接对象SqlConnection是否已经释放??如果没释放的话,打开多了,没有可用的连接资源,再连接的话当然报错了!这个要检查程序的。还有就是增大配置文件中连接池数目Max   Pool   Size=100;Min   Pool   Size=5;Pooling=true;
      

  3.   

    你说的俺知道 我是想知道怎么解决问题 还有 DATATABLE 是自动释放连接对象(SqlConnection)的 你难道不知道?还有using(){} 也是可以用来自动释放连接对象的ls的 你说的是对的 我是连接过多  但是我在那个页面 用了2个datatable 返回的Ilist对象集合 
    来进行查询 按道理说 不会出现连接数过多啊? 我源代码 找了N次了 没看到有错的地方 /// <summary>
            /// 根据 isActive 字段查询表 rm_Project 的数据
            /// </summary>
            /// <param name="isActive">字段</param>
            /// <returns></returns>
            public static IList<RiskMatrix_rm_Project> list(string isActive)
            {
                IList<RiskMatrix_rm_Project> list = new List<RiskMatrix_rm_Project>();
                string sql = "pro_rm_Project_isActive";
                bool Active = Convert.ToBoolean(isActive);
                SqlParameter[] para = new SqlParameter[] 
                {
                    new SqlParameter("@isActive",Active)
                };
                DataTable table = SqlHelper.ExecuteDataTable(sql, CommandType.StoredProcedure, para);
                foreach (DataRow item in table.Rows)
                {
                    RiskMatrix_rm_Project project = new RiskMatrix_rm_Project();
                    project.projectRNO = Convert.ToInt32(item["projectRNO"]);
                    project.projectname = Convert.ToString(item["projectname"]);
                    project.isrestricted = Convert.ToString(item["isrestricted"]);
                    project.probabilityscale = Convert.ToInt32(item["probabilityscale"]);
                    project.impactscale = Convert.ToInt32(item["impactscale"]);
                    project.manageabilityscale = Convert.ToInt32(item["manageabilityscale"]);
                    project.riskscale = Convert.ToInt32(item["riskscale"]);
                    project.createddate = Convert.ToString(item["createddate"]);
                    project.status = Convert.ToInt32(item["status"]);
                    project.isActive = Convert.ToString(item["isActive"]);
                    project.ArchiveDate = Convert.ToString(item["ArchiveDate"]);
                    project.ArchivedBy = Convert.ToString(item["ArchivedBy"]);
                    list.Add(project);
                }
                return list;
            }
      

  4.   

    在ExecuteDataTable这个方法里把commandtimeout设置长一点。用loadrunner跑一下IIS并发数