我在 mvc3 应用程序中创建了一个连接字符串,它在 mvc View 和 Controller 中工作正常,我能够获取数据。现在我在测试项目的单元测试中调用了存储库/模型函数,但出现错误:
System.Data.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---> System.Data.SqlClient.SqlException: Invalid object name 'dbo.tblProduct'.
我该如何解决?
最佳答案
这与 MVC 无关。看起来,在测试时,您在没有“dbo.tblProduct”表/ View 的数据库上使用 ConnectionString。检查连接字符串和数据库。您可能需要调试测试
关于asp.net - System.Data.EntityCommandExecutionException : An error occurred while executing th,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5595541/