This project is read-only.
1
Vote

EntityCommandExecutionException

description

here is the error stack:
System.Data.EntityCommandExecutionException was unhandled by user code
Message=An error occurred while executing the command definition. See the inner exception for details.
Source=System.Data.Entity
StackTrace:
   at System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
   at System.Data.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues)
   at System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
   at System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
   at System.Data.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__3[TResult](IEnumerable`1 sequence)
   at System.Data.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable`1 query, Expression queryRoot)
   at System.Data.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[S](Expression expression)
   at System.Linq.Queryable.Single[TSource](IQueryable`1 source, Expression`1 predicate)
   at MVCForms.Controllers.FormController.Respond(String shortPath) in C:\Users\jbarrett\Downloads\MVCForms\MVCForms\MVCForms\Controllers\FormController.cs:line 296
   at lambda_method(Closure , ControllerBase , Object[] )
   at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
   at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
   at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClassd.<InvokeActionMethodWithFilters>b__a()
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
InnerException: System.InvalidOperationException
   Message=There is already an open DataReader associated with this Command which must be closed first.
   Source=System.Data
   StackTrace:
        at System.Data.SqlClient.SqlInternalConnectionTds.ValidateConnectionForExecute(SqlCommand command)
        at System.Data.SqlClient.SqlConnection.ValidateConnectionForExecute(String method, SqlCommand command)
        at System.Data.SqlClient.SqlCommand.ValidateCommand(String method, Boolean async)
        at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
        at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
        at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
        at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
        at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
        at System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
   InnerException:

file attachments

comments

jhb wrote Dec 8, 2010 at 3:04 AM

nice ideas here - there is another codeplex project that is kind of similar except it is a dynamic data app
http://dynamicdatalayout.codeplex.com/

jhb wrote Dec 8, 2010 at 3:14 AM

just had another look - best to not use class level variables to hold contexts...
do this instead:
using (MVCFormsFormEntities mvcForms = new MVCFormsFormEntities())
{
.......
}

wrote Feb 14, 2013 at 12:32 AM