Click to See Complete Forum and Search --> : Problem!


carrolf255
02-23-2004, 02:53 AM
I have come across a small problem:
I have an ASP form for users to enter details and these are then stored in an Access DB. The ASP generates SQL strings from the data collected from the form. However, if someone enters their name and the name has a ' in it such as John O'Connor or Bill O'Shea, the ASP generates an error because the SQL sees the ' as a delimiter. How can I get around this?

buntine
02-23-2004, 04:50 AM
This is quite a common ASP database problem.
Luckily, its quite simple to get around.

use the following code to replace single quotes with double quotes.


yourDetails = Replace(yourDetails,"'","""")


yourDetails refers to the variable which holds the data that contains a the single quote character.

Regards,
Andrew Buntine.