Well, seeing as you posted this message in the ASPX forum, I'm assuming that you are using some ADO.NET classes to make database calls. For example: System.Data.SqlClient.Connection and System.Data.SqlClient.Command. The Command objects for the SqlClient as well as the other native .NET database clients have a parameters collection into which you add an instance of the appropriate parameter class. When you assign one of these parameters a value, the class itself handles the escaping of the necessary SQL characters. So you can create a query: "UPDATE MyTable SET myField = @myParameter", then set the parameter "@myParameter" value to "mc'value" and the parameter class or the command class (which one is really irrelevant) will automatically generate the correct complete SQL string: "UPDATE MyTable SET myField = 'mc''value'"
|