Server Error in '/' Application.

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

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

Source Error:


Line 28:             SqlDataAdapter da = new SqlDataAdapter(command);
Line 29:             DataSet ds = new DataSet();
Line 30:             da.Fill(ds, "Profiles");
Line 31:             DataTable ProfilesTable = ds.Tables["Profiles"];
Line 32:             if (conn.State != ConnectionState.Closed) { conn.Close(); }

Source File: c:\WWWROOT\orangebooks.ir\httpdocs\App_Code\Profiles.cs    Line: 30

Stack Trace:


[InvalidOperationException: ExecuteReader requires an open and available Connection. The connection's current state is open.]
   System.Data.SqlClient.SqlConnection.GetOpenConnection(String method) +43
   System.Data.SqlClient.SqlConnection.ValidateConnectionForExecute(String method, SqlCommand command) +72
   System.Data.SqlClient.SqlCommand.ValidateCommand(String method, Boolean async) +268
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) +118
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +64
   System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +161
   System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +37
   System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +10
   System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +138
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +134
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +85
   Profiles.View.Get(String Ref_Id, String Ref_Db) in c:\WWWROOT\orangebooks.ir\httpdocs\App_Code\Profiles.cs:30
   ASP.books_bookview_aspx.__RenderContent3(HtmlTextWriter __w, Control parameterContainer) in c:\WWWROOT\orangebooks.ir\httpdocs\Books\BookView.aspx:401
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +103
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +9
   System.Web.UI.Control.Render(HtmlTextWriter writer) +10
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +129
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +287
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +26
   ASP.masterpage_master.__Renderform1(HtmlTextWriter __w, Control parameterContainer) in c:\WWWROOT\orangebooks.ir\httpdocs\MasterPage.master:629
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +103
   System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +177
   System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +32
   System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +361
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +129
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +287
   System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +53
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +197
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +9
   System.Web.UI.Control.Render(HtmlTextWriter writer) +10
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +129
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +287
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +26
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +197
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +9
   System.Web.UI.Page.Render(HtmlTextWriter writer) +30
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +129
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +287
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +26
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5636


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