对SQL语句进行过滤的函数

/// <summary> 
/// 过滤SQL非法字符串 
/// </summary> 
/// <param name="value"></param> 
/// <returns></returns> 
public static string Filter(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; 
}

记录下

对SQL语句进行过滤的函数,布布扣,bubuko.com

对SQL语句进行过滤的函数

上一篇:用jdbc访问二进制类型的数据


下一篇:nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection