Last active
September 16, 2015 00:45
-
-
Save bungard/34ec40915f676171fbf2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void SQLServerEscapeObject(object obj) | |
{ | |
foreach (System.Reflection.PropertyInfo property in obj.GetType().GetProperties()) | |
{ | |
try | |
{ | |
if (property.PropertyType.FullName == "System.String" && property.GetValue(obj, null) != null) | |
{ | |
property.SetValue(obj, property.GetValue(obj, null).ToString().Replace("'", "''"), null); | |
} | |
} | |
catch (Exception e) { Logger.Log("Issue clensing SQL query: " + e.Message, Logger.Loglevel.Warning); } | |
} | |
return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment