码迷,mamicode.com
首页 > 数据库 > 详细

sql 查询条件过滤替换特许符号(‘,",+,!等)

时间:2015-01-27 07:09:33      阅读:232      评论:0      收藏:0      [点我收藏+]

标签:

查询条件过滤替换特许符号


public static string SpecialSymbols(string strText)
        {
            strText = strText.Trim();
            strText = strText.Replace("!", "‘ + char(33) + ‘");
            strText = strText.Replace("\"", "‘ + char(34) + ‘");
            strText = strText.Replace("$", "‘ + char(36) + ‘");
            strText = strText.Replace("%", "‘ + char(37) + ‘");
            strText = strText.Replace("&", "‘ + char(37) + ‘");
            strText = strText.Replace("‘", "‘ + char(39) + ‘");
            strText = strText.Replace("(", "‘ + char(40) + ‘");
            strText = strText.Replace(")", "‘ + char(41) + ‘");
            strText = strText.Replace("*", "‘ + char(42) + ‘");
            strText = strText.Replace("+", "‘ + char(43) + ‘");
            strText = strText.Replace(",", "‘ + char(44) + ‘");
            strText = strText.Replace("-", "‘ + char(45) + ‘");
            strText = strText.Replace(".", "‘ + char(46) + ‘");
            strText = strText.Replace("/", "‘ + char(47) + ‘");
            strText = strText.Replace("", "‘ + char(47) + ‘");
            return strText;
        }



可继续补充或者优化,未测试。


sql 查询条件过滤替换特许符号(‘,",+,!等)

标签:

原文地址:http://my.oschina.net/TOW/blog/372012

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!