Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
284 views
in Technique[技术] by (71.8m points)

entity framework - An error occurred while executing the command definition. See the inner exception for details

In my mvc asp.net application, I am getting an error in edit function : in given code

public ActionResult Edit(int id)
{

      var res = (from r in objeEntities.DocumentationsSet.Include("DocStatus")
                where r.textid == id select r)
                .First();
}

I am getting this exception:

Source : System.Data.Entity

Stack Trace : 
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.GetEnumerator()
at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
at System.Data.Objects.ELinq.ObjectQueryProvider.b__0[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.First[TSource](IQueryable`1 source)
at admin.com.Controllers.DocsGridController.Edit(Int32 id) in c:DataFinalCodeAC015acomMVCSourceCodeadmincomControllersDocsController.cs:line
   307

Message : An error occurred while executing the command definition. See the inner exception for details.

This error is generated when I connect with remote server.

What is this error? How do I fix it?

question from:https://stackoverflow.com/questions/3986160/an-error-occurred-while-executing-the-command-definition-see-the-inner-exceptio

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Usually this means that your schema and mapping files are not in synch and there is a renamed or missing column someplace.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...