Monday, March 19, 2012

Safe SQL Like Clause Literal C#

    public static string SafeSqlLikeClauseLiteral(string prmSQLString)
    {
        string s = prmSQLString;
        s = s.Replace("'", "''");
        s = s.Replace("[", "[[]");
        s = s.Replace("%", "[%]");
        s = s.Replace("_", "[_]");
        return (s);
    }

Please visit: www.TyroDeveloper.com

Please Click on +1

No comments:

Post a Comment