asp.net - System.Data.EntityCommandExecutionException : An error occurred while executing th

标签 asp.net asp.net-mvc-3

我在 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/

相关文章:

c# - 进程外 SessionState 内存管理

ajax - jQuery .append(html) 命令附加错误

jquery - 在文本框上手动设置不显眼的验证错误

jQuery DataTable 溢出和文本换行问题

c# - 如何在 ASP.NET MVC3 中填充 ViewModel

c# - Html.BeginForm 没有发回整个数据

asp.net - ScriptResource.axd 访问被拒绝。跨域 iFrame

c# - 找到与请求 (GET) 匹配的多个操作

C# - 添加方法后显示错误

.net - 数据服务抛出神秘异常 : "Media type requires a ' /' character"