Forums

ASP

This topic is locked

Help Please!

Posted 17 Jan 2003 12:39:55
1
has voted
17 Jan 2003 12:39:55 Tony Chronopoulos posted:
When I click Submit to process my form and write it to the DB, I get an error if a string contains a single quote (probably even a double quote). I know it's the way I wrote my SQL string - by putting a single quote in a form field, it seems to be closing the string there... know what I mean? hehe.

How can I fix that? Here's a snippet of my sql string.

<pre id=code><font face=courier size=2 id=code>

strSQL = "UPDATE tbl_ecom_shippingAddresses SET shipping_location = '" & sname
strSQL = strSQL & "', shipping_fname = '" & sfname
strSQL = strSQL & "', shipping_lname = '" & slname
strSQL = strSQL & "', shipping_company = '" & scompany
strSQL = strSQL & "', shipping_address1 = '" & saddress1
strSQL = strSQL & "', shipping_address2 = '" & saddress2
strSQL = strSQL & "', shipping_city = '" & scity
strSQL = strSQL & "', shipping_province = '" & sprovince
strSQL = strSQL & "', shipping_postal = '" & spostal
strSQL = strSQL & "', shipping_country = '" & scountry
strSQL = strSQL & "', shipping_phone = '" & sphone
strSQL = strSQL & "', shipping_fax = '" & sfax
strSQL = strSQL & "' WHERE shipping_id = " & rsShippingAddress("shipping_ID"

</font id=code></pre id=code>

Thanks a lot !!!!!!!


Edited by - bloodtrain on 17 Jan 2003 12:40:52

Replies

Replied 17 Jan 2003 14:02:16
17 Jan 2003 14:02:16 Dave Blohm replied:
strSQL = strSQL & "' WHERE shipping_id = '" & rsShippingAddress("shipping_ID" & "'"

Maybe?

Doc
Rangewalk Digital Studios
Replied 17 Jan 2003 14:05:11
17 Jan 2003 14:05:11 Tony Chronopoulos replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
strSQL = strSQL & "' WHERE shipping_id = '" & rsShippingAddress("shipping_ID" & "'"

Maybe?

Doc
Rangewalk Digital Studios
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

I'll try it, but I think the problem is the text fields.. humm.. for once, when I decide not to use DMX and code on my own, I run into all these problems! <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

___________________
microdesign² | www.microdesign2.com
Replied 17 Jan 2003 14:07:10
17 Jan 2003 14:07:10 Tony Chronopoulos replied:
Nope, didn't work.

___________________
microdesign² | www.microdesign2.com
Replied 17 Jan 2003 14:17:20
17 Jan 2003 14:17:20 Marja Ribbers-de Vroed replied:
Try using the Replace function for the single quotes in the alphanumeric fields, eg.

<pre id=code><font face=courier size=2 id=code>
strSQL = "UPDATE tbl_ecom_shippingAddresses SET shipping_location = '" & Replace(sname,"'", "''"
</font id=code></pre id=code>



--
Marja Ribbers-de Vroed
www.flevooware.nl
www.flevooware.nl/dreamweaver/
Replied 17 Jan 2003 14:19:38
17 Jan 2003 14:19:38 Tony Chronopoulos replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Try using the Replace function for the single quotes in the alphanumeric fields, eg.

<pre id=code><font face=courier size=2 id=code>
strSQL = "UPDATE tbl_ecom_shippingAddresses SET shipping_location = '" & Replace(sname,"'", "''"
</font id=code></pre id=code>

<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

But will the remove the single quote entirely from sname? If not, then cool..

___________________
microdesign² | www.microdesign2.com

Reply to this topic