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 71:             cmd = new OleDbCommand(cmdText, dbconn());
Line 72:             cmd.CommandType = ct;
Line 73:             res = cmd.ExecuteScalar().ToString();
Line 74:         }
Line 75:         catch (OleDbException ex)

Source File: d:\Program Files\woot\ninnkitokei\App_Code\mdb.cs    Line: 73

Stack Trace:


[InvalidOperationException: ExecuteScalar requires an open and available Connection. The connection's current state is connecting.]
   System.Data.OleDb.OleDbConnection.CheckStateOpen(String method) +1070163
   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
   mdb.ExecuteScalar(String cmdText, CommandType ct) in d:\Program Files\woot\ninnkitokei\App_Code\mdb.cs:73
   brandcopy.GetTotalPage(String idname, Int32 id) in d:\Program Files\woot\ninnkitokei\brandcopy.aspx.cs:34
   brandcopy.GetProducts() in d:\Program Files\woot\ninnkitokei\brandcopy.aspx.cs:81
   brandcopy.Page_Load(Object sender, EventArgs e) in d:\Program Files\woot\ninnkitokei\brandcopy.aspx.cs:22
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnLoad(EventArgs e) +91
   System.Web.UI.Control.LoadRecursive() +74
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1031