救命啊,大哥帮忙看看,这是什么错误,怎样解决,分不够还可以给呀。
Server Error in '/xxx' Application.
--------------------------------------------------------------------------------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. 
Description: 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. Exception Details: System.InvalidOperationException: 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.Source Error: 
Line 189:<%
Line 190:    SqlText = "select * from SYS_MODULE_ADMIN order by ID asc";
Line 191:    System.Data.SqlClient.SqlDataReader  dr = GetResult(SqlText);
Line 192:    if (dr.Read())
Line 193:    {
 Source File: e:\BuilHall\View\View.aspx    Line: 191 Stack Trace: 
[InvalidOperationException: 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.]
   System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +1188873
   System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
   System.Data.SqlClient.SqlConnection.Open() +111
   View_View.GetResult(String SQL) +56
   ASP.view_view_aspx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in e:\BuilHall\View\View.aspx:191
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +2113547
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +24
   System.Web.UI.Page.Render(HtmlTextWriter writer) +26
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1896 

解决方案 »

  1.   

    This   may   have   occurred   because   all   pooled   connections   were   in   use   and   max   pool   size   was   reached. 
    好象是代码里有没有关闭的连接,检查一下
      

  2.   

    SqlDataReader  关闭后,SqlConnection能自动关闭吗?
      

  3.   

    在使用连接的地方,最好使用using语句
      

  4.   

       这是我的程序,怎样关闭SqlConnection ?????? public SqlDataReader  GetResult( String  SQL)
        {        SqlConnection myConnection = DataService.GetConnection();
            SqlCommand myCommand = new SqlCommand(SQL, myConnection);
            myCommand.CommandType = CommandType.Text;
         
            myConnection.Open();
            SqlDataReader dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
            return dr;
        }
      

  5.   

    SqlDataReader rdr = GetResult;
    ...
    rdr.close();
      

  6.   

    SqlDataReader   cdr   =   GetResult; 
    ... 
    cdr.close();