sql防注入

public bool SqlSecret(string sql)
    {
        bool retbool=true;
        sql = sql.ToUpper();
        if (sql.Length == 0) return false;
        string strfileter = "exec,xp_,sp_,declare,cmd,union,//,..,0x,',--,;,delete,update,>,<,script,insert,select";
        strfileter = strfileter.ToUpper();
        string[] arrSqlError = strfileter.Split(',');
        for (int i = 0; i < arrSqlError.Length; i++)
        {
            if (sql.IndexOf(arrSqlError[0]) > -1)
            {
                retbool = false;
                break;
            }
        }
        return retbool;
    }
posted @ 2012-08-21 16:31  尹成亮  阅读(131)  评论(0编辑  收藏  举报