Jasonchne 2019-08-28 17:33 采纳率: 25%
浏览 971
已采纳

断言失败:Adort=Quit、Retry=Debug、Ignore=Continue

把DataTable的中的数据导入到数据表中出错,提示断言失败:Adort=Quit、Retry=Debug、Ignore=Continue,前台报错截图如下:

图片说明

我看了一下后台代码可以获取数据,也可以插入数据到数据库,为什么前台会抛出此异常,求大神指点。
后台代码如下:

1、插入数据代码
   protected void Btn_JS_Click(object sender, EventArgs e)
        {
            //DataBinds1();
            CenterBaseDAL.ExecuteSql cbde = new CenterBaseDAL.ExecuteSql();
            DataTable dt = new DataTable();
            string sql = "select * from View_YPCG";
            dt = cbde.GetTab_Sql(sql);



            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string yymc = dt.Rows[i][1].ToString();
                string kfmc = dt.Rows[i][5].ToString();
                string rkdh = dt.Rows[i][6].ToString();
                string fph = dt.Rows[i][7].ToString();
                string ypph = dt.Rows[i][8].ToString();
                string rkczy = dt.Rows[i][9].ToString();
                string rkrq = dt.Rows[i][10].ToString();
                string scrq = dt.Rows[i][11].ToString();
                string sxrq = dt.Rows[i][12].ToString();
                string jzczy = dt.Rows[i][13].ToString();
                string jzrq = dt.Rows[i][14].ToString();
                string ghdw = dt.Rows[i][15].ToString();
                string sccj = dt.Rows[i][16].ToString();
                string yplb = dt.Rows[i][17].ToString();
                string ypmc = dt.Rows[i][18].ToString();
                string ypgg = dt.Rows[i][19].ToString();
                string ypjj = dt.Rows[i][20].ToString();
                string ypsj = dt.Rows[i][21].ToString();
                string rksl = dt.Rows[i][22].ToString();
                string ypdw = dt.Rows[i][23].ToString();
                string jjzj = dt.Rows[i][24].ToString();
                string slzj = dt.Rows[i][25].ToString();
                string jxce = dt.Rows[i][26].ToString();
                string pzwh = dt.Rows[i][27].ToString();

                string sql1 = "insert into HJY_GYL_YPFX(yymc,kfmc,rkdh,fph,ypph,rkczy,rkrq,scrq,sxrq,jzczy,jzrq,ghdw,sccj,yplb,ypmc,ypgg,ypjj,ypsj,rksl,ypdw,jjzj,lszj,jxcj,pzwh) " +
                    "values('" + yymc + "'," + "'" + kfmc + "'," + "'" + rkdh + "'," + "'" + fph + "'," + "'" + ypph + "'," + "'" + rkczy + "'," + "'" + rkrq + "'," + "'" + scrq + "'," + "'" + sxrq + "'," + "'" + jzczy + "'," + "'" + jzrq + "'," + "'" + ghdw + "',"+"'" + sccj + "'," + "'" + yplb + "'," + "'" + ypmc + "'," + "'" + ypgg + "'," + "'" + ypjj + "'," + "'" + ypsj + "'," + "'" + rksl + "'," + "'" + ypdw + "'," + "'" + jjzj + "'," + "'" + slzj + "'," + "'" + jxce + "'," + "'" + pzwh + "'" + ")";
                int falg = cbde.run(sql1);
                if (falg == 1)
                {
                    CenterBaseTools.Common.Alert(this.Page, "还原成功!");
                }
                else
                {
                    CenterBaseTools.Common.Alert(this.Page, cbde.ErrorMessage);
                }

            }

            Response.Write("<script language=javascript>window.open('../YPCGJS.aspx')</script>");
        }
2、ExecuteSql代码
public DataTable GetTab_Sql(string sql)
        {
            ConfigManager config = new ConfigManager();
            DataTable dt = new DataTable();
            SqlDataAdapter sqldt = new SqlDataAdapter(sql, config.DALConnectionString);
            //this.ErrorMessage = sproc.ErrorMessage.ToString();
            sqldt.Fill(dt);

            return dt;
        }
  • 写回答

2条回答 默认 最新

  • Jasonchne 2019-08-29 14:26
    关注

    已解决,同意楼上观点,遇到问题只能自己先调试了。调试过程中我发现有一个参数一直不为NULL,更改该参数的判断条件,就没有“断言失败:Adort=Quit、Retry=Debug、Ignore=Continue”的错误提示了。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 驱动学习 环境部署中的问题
  • ¥15 【急】在线问答CNC雕刻机的电子电路与编程
  • ¥60 在mc68335芯片上移植ucos ii 的成功工程文件
  • ¥15 笔记本外接显示器正常,但是笔记本屏幕黑屏
  • ¥15 Python pandas
  • ¥15 蓝牙硬件,可以用哪几种方法控制手机点击和滑动
  • ¥15 生物医学数据分析。基础课程就v经常唱课程舅成牛逼
  • ¥15 云环境云开发云函数对接微信商户中的分账功能
  • ¥15 空间转录组CRAD遇到问题
  • ¥20 materialstudio计算氢键脚本问题