---
title: "EntityCommandExecutionException was unhandled see innerException for Details"  
description: "EntityCommandExecutionException was unhandled see innerException for Details"  
author: "E E Cummings"  
published: 2013-06-19  
updated: 2013-06-19  
canonical: https://www.mindstick.com/forum/1205/entitycommandexecutionexception-was-unhandled-see-innerexception-for-details  
category: "ado.net"  
tags: ["ado.net"]  
reading_time: 2 minutes  

---

# EntityCommandExecutionException was unhandled see innerException for Details

Hi All,\
\
I [am trying](https://answers.mindstick.com/qa/36834/which-two-programming-languages-should-i-master-in-if-i-am-trying-to-get-into-google-or-facebook) to connect my C# [application](https://www.mindstick.com/articles/12824/calculator-application-in-android) with [SQL server](https://www.mindstick.com/articles/12999/what-is-table-valued-function-in-sql-server) compact edition using ADO.NET entity Model.\
\
I think I have been successfully able to generate the model against the [database schema](https://www.mindstick.com/forum/160254/how-to-apply-a-migration-to-update-the-database-schema-in-entity-framework-core).\
\
However when I try to use the entity objects in code I get the\
\
EntityCommandExecutionException` was unhandled error along with "An error occurred while executing the command definition. See the inner [exception](https://www.mindstick.com/articles/1824/objective-c-exception-handling) for details."\
\
Here's the code\
\
Database1Entities db = new Database1Entities();\
var query = from item in db.People\
select Name;\
foreach (var item in query)\
{\
MessageBox.Show("The name of the customer is " + item);\
}\
\
It says to check inner exception. When I did checked InnerException gave me the error\
\
"InnerException {"A [parameter](https://www.mindstick.com/blog/450/parameter-class-in-c-sharp) is not allowed in this location. Ensure that the '@' sign is in a valid location or that [parameters](https://www.mindstick.com/articles/87/passing-parameters-in-c-sharp) are valid at all in this SQL \
\
statement."} System.Exception {System.Data.SqlServerCe.SqlCeException}"\
\
Now I am entirely new to using [entity framework](https://www.mindstick.com/articles/1566/crud-operations-using-entity-framework-code-first-approach) for generating objects from database sachems. I would really appreciate some guidance in this regard.\
\
Thanks in advance for any recommendations or solutions.\

## Replies

### Reply by Anonymous User

Hi,\
The problem wasn't with entity [framework](https://www.mindstick.com/forum/34615/software-framework-vs-library) or connection.\
The problem was with your LINQ query.\
The correct query as following\
**var query = from item in db.People** **select item.Name;**


---

Original Source: https://www.mindstick.com/forum/1205/entitycommandexecutionexception-was-unhandled-see-innerexception-for-details

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
