Home » Visual StudioRSS

System.Data.EntityCommandExecutionException

Hi,

when I try to get some data from my WCD data service, for some entities I have System.Data.EntityCommandExecutionException error.

I try: http://localhost/MyDataService.svc/MyEntityName

the error is:

 <?xml version="1.0" encoding="utf-8" standalone="yes" ?> 
- <error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
 <code /> 
 <message xml:lang="en-GB">An error occurred while processing this request.</message> 
- <innererror>
 <message>An error occurred while executing the command definition. See the inner exception for details.</message> 
 <type>System.Data.EntityCommandExecutionException</type> 
 <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.Data.Objects.ObjectQuery`1.GetEnumeratorInternal() at System.Data.Objects.ObjectQuery.System.Collections.IEnumerable.GetEnumerator() at System.Data.Services.WebUtil.GetRequestEnumerator(IEnumerable enumerable) at System.Data.Services.DataService`1.SerializeResponseBody(RequestDescription description, IDataService dataService) at System.Data.Services.DataService`1.HandleNonBatchRequest(RequestDescription description) at System.Data.Services.DataService`1.HandleRequest()</stacktrace> 
- <internalexception>
 <message>Incorrect syntax near 'MyEntityName'.</message> 
 <type>System.Data.SqlClient.SqlException</type> 
 <stacktrace>at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlDataReader.ConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, 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)</stacktrace> 
 </internalexception>
 </innererror>
 </error>

Any ideas how I can debug or trace the sql in question?

cheers

Valko

 

 

2 Answers Found

 

Answer 1

 hi

Hope you have an idea of sql  Server Profile to make sure what query is being executed in SQL Server..

Or Linq to SQL tools can even give a hint how the sql is fomed...

Please let me know if this does not work..

Thanks with my 2cents

Phani

 

 

 

Answer 2

it was edmx model not updated, I've updated the model and it works fine now...
 
 
 

<< Previous      Next >>


Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter