Sql server &引用;System.AccessViolationException:尝试读取或写入受保护的内存“;在填充数据表时
使用ASP.NET 4.51和VS 2013,我在尝试使用存储过程填充数据表时遇到以下错误Sql server &引用;System.AccessViolationException:尝试读取或写入受保护的内存“;在填充数据表时,sql-server,vb.net,stored-procedures,ado.net,Sql Server,Vb.net,Stored Procedures,Ado.net,使用ASP.NET 4.51和VS 2013,我在尝试使用存储过程填充数据表时遇到以下错误 System.AccessViolationException: Attempted to read or write protected memory 我已将错误追溯到以下方面: Using myDT As New DAL.mbr_MediaComments.usrsp_mbr_MediaComments_CommentorsDataTable Using myTA As New DAL.mb
System.AccessViolationException: Attempted to read or write protected memory
我已将错误追溯到以下方面:
Using myDT As New DAL.mbr_MediaComments.usrsp_mbr_MediaComments_CommentorsDataTable
Using myTA As New DAL.mbr_MediaCommentsTableAdapters.usrsp_mbr_MediaComments_CommentorsTableAdapter
myTA.Fill(myDT, toMbrID, mediaID) <------System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
我发现问题,错误是由以下原因造成的:
Using myDT As New DAL.mbr_MediaComments.usrsp_mbr_MediaComments_CommentorsDataTable
Using myTA As New DAL.mbr_MediaCommentsTableAdapters.usrsp_mbr_MediaComments_CommentorsTableAdapter
myTA.Fill(myDT, toMbrID, mediaID) <------System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
存储过程已将其中一个参数定义为bigint
它应该是数据库表模式中定义的int
我似乎将整数值传递给需要Bigint的表适配器存储过程会导致AccessViolationException错误。
我希望这些信息对其他人有所帮助。在int和bigint之间进行转换不会导致AccessViolationException!关于.Net 4.51(VS2013也随附)还有一个更大的问题,多个用户在不同的代码路径中遇到类似的错误,并向Microsoft报告;他们还没有决定。@user1898611是什么让你认为这不是OP发现和修复的东西?你有什么链接吗?请注意,修复数据类型实际上修复了OP的问题。是的,这个问题在本例中已完全修复。数据类型转换是错误的原因。我用的是VS2013和.net 4.51谢谢你,你救了我一天。我也犯了同样的错误,按照你的建议解决了。(.net 4.5.1与2013年相比)