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

前端 未结 9 1702
攒了一身酷
攒了一身酷 2020-12-15 03:07

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 objeEnti         


        
相关标签:
9条回答
  • 2020-12-15 03:21

    I had a similar situation with the 'An error occurred while executing the command definition' error. I had some views which were grabbing from another db which used current user security. The second db did not allow the login for the user of the first db causing this issue to occur. I added the db login to the server it was trying to get to from the original server and this fixed the issue. Check your views and see if there are any linked dbs which have different security than the db you are logging onto originally.

    0 讨论(0)
  • 2020-12-15 03:23

    After spending hours, I found that I missed 's' letter in table name

    It was [Table("Employee")] instead of [Table("Employees")]

    0 讨论(0)
  • 2020-12-15 03:24

    In my case, I messed up the connectionString property in a publish profile, trying to access the wrong database (Initial Catalog). Entity Framework then complains that the entities do not match the database, and rightly so.

    0 讨论(0)
  • 2020-12-15 03:26

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

    0 讨论(0)
  • 2020-12-15 03:27

    In my case, It was from Stored Producers. I was removed a field from table and forgotten to remove it from my SP.

    0 讨论(0)
  • 2020-12-15 03:30

    Does the actual query return no results? First() will fail if there are no results.

    0 讨论(0)
提交回复
热议问题