rStr = rStr.Replace("'", "''
"); 

解决方案 »

  1.   


    string rStr = "AAA'BBB'CCC";
            rStr = rStr.Replace("'", "\\'");
            Response.Write(rStr);
      

  2.   

    标签 'http' 已声明。标签名称在批查询或存储过程内部必须唯一没办法了. 我怎么试都不行. 有遇到过这样的问题吗?html的语法不能写到update里吗? 那舔加文章怎么搞的?
      

  3.   

    你这样又是\又是’ 不烦吗?为什么不把怎么html代码作为一个字段保存?
      

  4.   

    这html代码就是一个字段呀!问题是我string strSql = "UPDATE [tb_style] SET " + strTemplateName + " = '" + TemplateContent + "'  WHERE (([id] = " + Convert.ToInt16(_ID) + "))";
    就出错了.
      

  5.   

    string strSql = "UPDATE [tb_style] SET " + strTemplateName + " = '" + TemplateContent.Replace("'","''") + "'  WHERE (([id] = " + Convert.ToInt16(_ID) + "))";