When you add records into a database you need to escape special characters like the single quote (') else your insert statement might fail.
After searching hard I found that C# does provide a method that does escaping by providing a string parameter and returning the escaped string, the surprise is that its not part of the String class but actually inside the SecurityElement class thats part of the System.Security namespace... find the Escape method!Now I wonder... why did Microsoft add it to that namespace? :-( grrr....
After searching hard I found that C# does provide a method that does escaping by providing a string parameter and returning the escaped string, the surprise is that its not part of the String class but actually inside the SecurityElement class thats part of the System.Security namespace... find the Escape method!Now I wonder... why did Microsoft add it to that namespace? :-( grrr....
No comments:
Post a Comment