Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Single Quote give syntax error

Status
Not open for further replies.

mrwebrrr

Programmer
Mar 18, 2001
1
US
Hi,

Bear with my imprecise description, I am a designer hacking through this!

I have an asp page that is pulling data from a SQL database, and when the submit button is hit and there is a single quote " ' " in the content I am trying to insert I get a syntax error.

How can I stop these single quotes from truncating my data on insertion into the database??

I really appreciate any advice (as will my client :)
 
SQL Server can use either ' or " to delimit strings, so why not wrap the whole string in "" rather than ''.
It's not a proper solution, but it's a quick one.
Otherwise if you use ADO Command and Parameter objects, and put the string into a Parameter, it doesn't matter if it has ' or " in it.

Ben
+61 403 395 052
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top