加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net-mvc – System.Data.SqlClient.SqlException:无效的对

发布时间:2020-12-15 23:32:39 所属栏目:asp.Net 来源:网络整理
导读:我的MVC应用程序在尝试访问数据库中的任何表时返回SqlExceptions. 异常详细信息:System.Data.SqlClient.SqlException:无效的对象名称“dbo.Projects”. 我的应用程序我们linq为数据层. 如果我使用旧的dll它工作正常(所以似乎不是一个问题的DB)只是这个最新
我的MVC应用程序在尝试访问数据库中的任何表时返回SqlExceptions.

异常详细信息:System.Data.SqlClient.SqlException:无效的对象名称“dbo.Projects”.

我的应用程序我们linq为数据层.

如果我使用旧的dll它工作正常(所以似乎不是一个问题的DB)只是这个最新的应用程序DLL,我已经上传.

细节

[SqlException (0x80131904): Invalid object name ‘dbo.Projects’.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception,
Boolean breakConnection) +1950890
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception,Boolean breakConnection) +4846875
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj) +194 System.Data.SqlClient.TdsParser.Run(RunBehavior
runBehavior,SqlCommand cmdHandler,SqlDataReader dataStream,
BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateObject
stateObj) +2392
System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +33
System.Data.SqlClient.SqlDataReader.get_MetaData() +83
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds,
RunBehavior runBehavior,String resetOptionsString) +297
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior
cmdBehavior,RunBehavior runBehavior,Boolean returnStream,Boolean
async) +954
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
cmdBehavior,String
method,DbAsyncResult result) +162
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
cmdBehavior,String
method) +32
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
behavior,String method) +141
System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior
behavior) +12 System.Data.Common.DbCommand.ExecuteReader() +12
System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query,
QueryInfo queryInfo,IObjectReaderFactory factory,Object[]
parentArgs,Object[] userArgs,ICompiledSubQuery[] subQueries,Object
lastResult) +975
System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query,
QueryInfo[] queryInfos,Object[]
userArguments,ICompiledSubQuery[] subQueries) +113
System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression
query) +344
System.Data.Linq.DataQuery1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
+35 System.Linq.Buffer
1..ctor(IEnumerable1 source) +247 System.Linq.<GetEnumerator>d__0.MoveNext() +108
System.Linq.Buffer
1..ctor(IEnumerable1 source) +259
System.Linq.<GetEnumerator>d__0.MoveNext() +108
System.Collections.Generic.List
1..ctor(IEnumerable1 collection)
+7665172 System.Linq.Enumerable.ToList(IEnumerable
1 source) +61 Mezza_crm.Controllers.ProjectsController.GetProjectList(NameValueCollection form) in C:mezza_crmmezza_crmControllersProjectsController.cs:164
Mezza_crm.Controllers.ProjectsController.List() in
C:mezza_crmmezza_crmControllersProjectsController.cs:53
lambda_method(ExecutionScope,ControllerBase,Object[] ) +39
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase
controller,Object[] parameters) +17
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext
controllerContext,IDictionary2 parameters) +178
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext
controllerContext,ActionDescriptor actionDescriptor,IDictionary
2
parameters) +24
System.Web.Mvc.<>c__DisplayClassa.b__7()
+52 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter
filter,ActionExecutingContext preContext,Func1 continuation) +254
System.Web.Mvc.<>c__DisplayClassc.<InvokeActionMethodWithFilters>b__9()
+19 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext
controllerContext,IList
1 filters,
IDictionary`2 parameters) +192
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext
controllerContext,String actionName) +399
System.Web.Mvc.Controller.ExecuteCore() +126
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)
+27 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext
requestContext) +7
System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext)
+151 System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext) +57
System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext
httpContext) +7
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+181 System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean& completedSynchronously) +75

解决方法

检查连接字符串中的初始目录参数.可能是您的代码正在为Projects对象查找错误的数据库.

例如,如果您具有数据库同步设置,只有主数据库表的一部分被传输,那么如果Linq to SQL希望所有表都位于连接字符串指向的数据库中,则可能会遇到此错误.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读