/// <summary> ///SQL注入过滤 /// </summary> /// <param name="InText">要过滤的字符串</param> /// <returns>如果参数存在不安全字符,则返回true</returns> public static bool SqlFilter(string InText) { string word = "and|exec|insert|select|delete|update|chr|mid|master|or|truncate|char|declare|join|drop|table"; if (InText == null) return false; foreach (string i in word.Split('|')) { if ((InText.ToLower().IndexOf(i + " ") > -1) || (InText.ToLower().IndexOf(" " + i) > -1)) { return true; } } return false; }