"System.AccessViolationException:尝试读取或写入受保护的内存"在填充DataTable时

 手机用户2502851955 发布于 2023-02-07 08:11

使用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.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.

这是我的存储过程定义:

CREATE PROCEDURE [dbo].[usrsp_mbr_MediaComments_Commentors] 
-- Add the parameters for the stored procedure here
@mbrID int = 0,
@mediaID bigint = 0

AS
BEGIN

    //my query code

END

George Filip.. 6

我发现了问题,错误是由以下原因造成的:

存储过程已将其中一个参数定义为bigint

它应该是数据库表模式中定义的int.

我似乎将Integer值传递给表适配器Stored Procedure期望Bigint导致AccessViolationException错误.

我希望这些信息有助于其他人.

1 个回答
  • 我发现了问题,错误是由以下原因造成的:

    存储过程已将其中一个参数定义为bigint

    它应该是数据库表模式中定义的int.

    我似乎将Integer值传递给表适配器Stored Procedure期望Bigint导致AccessViolationException错误.

    我希望这些信息有助于其他人.

    2023-02-07 08:16 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有