In our last tip we discussed
one of the limitations of using the single quote (') character
in your SQL strings. While doubling up the character has
become the norm for a lot of programmers, there are times when
it's not neccessary and will cause improper text to be inserted
into your database.
When using the native ADO methods for dealing with your
recordsets there is no need to double up your single quote
characters. For instance, this code is perfectly valid and
won't cause any quote related problems when executed:
rst.AddNew
rst.Fields("quote").Value = "Here's a sample."
rst.Update
While this should by no means be a reason to change the way
you access your database, it is something that needs to be
kept in mind. Twice as many quotes isn't always a good thing!
If you have a tip you would like to submit, please send it to:
webmaster@asp101.com.