Server Error in '/' Application.

ExecuteScalar requires an open and available Connection. The connection's current state is connecting.

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: ExecuteScalar requires an open and available Connection. The connection's current state is connecting.

Source Error:


Line 225:			cmd.CommandType = CommandType.Text;
Line 226:			cmd.Connection = GetConnection();
Line 227:			int tmpCount = Int32.Parse(cmd.ExecuteScalar().ToString());			
Line 228:			Close();
Line 229:			if (tmpCount < 1)

Source File: d:\wwwrootV2\CottonPro\App_Code\Proxy\CateProxy.cs    Line: 227

Stack Trace:


[InvalidOperationException: ExecuteScalar requires an open and available Connection. The connection's current state is connecting.]
   System.Data.OleDb.OleDbConnection.CheckStateOpen(String method) +994543
   System.Data.OleDb.OleDbCommand.ValidateConnection(String method) +25
   System.Data.OleDb.OleDbCommand.ValidateConnectionAndTransaction(String method) +18
   System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +56
   System.Data.OleDb.OleDbCommand.ExecuteScalar() +116
   CateProxy.IsExistSubCate(Int32 id) in d:\wwwrootV2\CottonPro\App_Code\Proxy\CateProxy.cs:227
   MasterPage.dlCateList_ItemDataBound(Object sender, DataListItemEventArgs e) in d:\wwwrootV2\cottonpro\MasterPage.master.cs:115
   System.Web.UI.WebControls.DataList.OnItemDataBound(DataListItemEventArgs e) +8770710
   System.Web.UI.WebControls.DataList.CreateItem(Int32 itemIndex, ListItemType itemType, Boolean dataBind, Object dataItem) +137
   System.Web.UI.WebControls.DataList.CreateControlHierarchy(Boolean useDataSource) +459
   System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e) +54
   System.Web.UI.WebControls.BaseDataList.DataBind() +55
   System.Web.UI.WebControls.BaseDataList.EnsureDataBound() +60
   System.Web.UI.WebControls.BaseDataList.CreateChildControls() +69
   System.Web.UI.Control.EnsureChildControls() +87
   System.Web.UI.Control.PreRenderRecursiveInternal() +44
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842


Version Information: Microsoft .NET Framework Version:2.0.50727.8784; ASP.NET Version:2.0.50727.8762