【C#】过滤Sql语句非法字符串

过滤Sql语句非法字符串
/// 
/// 过滤SQL非法字符串
/// 
/// 
/// 
public static string GetSafeSQL(string value)
{
    if (string.IsNullOrEmpty(value))
        return string.Empty;
    value = Regex.Replace(value, @";", string.Empty);
    value = Regex.Replace(value, @"'", string.Empty);
    value = Regex.Replace(value, @"&", string.Empty);
    value = Regex.Replace(value, @"%20", string.Empty);
    value = Regex.Replace(value, @"--", string.Empty);
    value = Regex.Replace(value, @"==", string.Empty);
    value = Regex.Replace(value, @"<", string.Empty);
    value = Regex.Replace(value, @">", string.Empty);
    value = Regex.Replace(value, @"%", string.Empty);
    return value;
}  

你可能感兴趣的:(【C#】过滤Sql语句非法字符串)