Server Error in '/' Application.

There is already an open DataReader associated with this Command which must be closed first.

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: There is already an open DataReader associated with this Command which must be closed first.

Source Error:


Line 375:            con.Open();
Line 376:        }
Line 377:        dr = cmd.ExecuteReader();
Line 378:        DataTable dt = new DataTable();
Line 379:        dt.Load(dr);

Source File: h:\root\home\comoody-001\www\moody\App_Code\GMarket.cs    Line: 377

Stack Trace:


[InvalidOperationException: There is already an open DataReader associated with this Command which must be closed first.]
   System.Data.SqlClient.SqlInternalConnectionTds.ValidateConnectionForExecute(SqlCommand command) +1647630
   System.Data.SqlClient.SqlConnection.ValidateConnectionForExecute(String method, SqlCommand command) +91
   System.Data.SqlClient.SqlCommand.ValidateCommand(String method, Boolean async) +274
   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) +119
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +65
   System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +170
   System.Data.SqlClient.SqlCommand.ExecuteReader() +104
   GMarket.allproduct() in h:\root\home\comoody-001\www\moody\App_Code\GMarket.cs:377
   shop.Page_Load(Object sender, EventArgs e) in h:\root\home\comoody-001\www\moody\CLIENT\shop.aspx.cs:277
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +52
   System.Web.UI.Control.OnLoad(EventArgs e) +97
   System.Web.UI.<LoadRecursiveAsync>d__246.MoveNext() +229
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +102
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +64
   System.Web.Util.WithinCancellableCallbackTaskAwaiter.GetResult() +32
   System.Web.UI.<ProcessRequestMainAsync>d__523.MoveNext() +4853


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