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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL quote help 1

Status
Not open for further replies.

gregmosu

Programmer
Jul 8, 2002
117
US
I am very new to vbscript and need help handling single quote marks that show up in strings.

ex)
insert into Table1(id, desc) values('NO893','plastic 3/4' tube.')

As you can see, the single quote mark after 3/4 is causing problems. If I were using java, I'd use a prepared statement to handle quotation formatting for me, but with vbscript, I have no idea how to do this. Any suggestions would be very helpfull.

Thanks,
Greg
 
Apprently if you double up on your single quotes that should sort it where there is a ' in the data you should set it to be '' - you could suse a routine as below:

Function ChangeQuoteX2(strlocalCustname As String)

ChangeQuoteX2 = Replace(strlocalCustname, "'", "''")

End Function

Hope it helps....
 
Thanks Tom, thats exactly what I was looking for.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top