Apostrophe Errors Out Form

Apostrophe Errors Out Form

am 14.04.2005 05:02:50 von PinkBishop

Hello All,

Hope you can help.

Below is the code I use to send data from form to database.

Problem is if an apostrophe is entered in cQuestion field or any field
for that matter the form errors out. Please Help.



mySQL= mySQL &
"(cEmail,cFirst,cLast,cStreet,cCity,cState,cZip,cHomePh,cBus Ph,cFax,cQuestion)"

mySQL= mySQL & "VALUES ('" & Request.Form("cEmail") & "','"
mySQL= mySQL & Request.Form("cFirst") & "'"
mySQL= mySQL & ",'" & Request.Form("cLast") & "'"
mySQL= mySQL & ",'" & Request.Form("cStreet") & "','"
mySQL= mySQL & Request.Form("cCity") & "','"
mySQL= mySQL & Request.Form("cState") & "','"
mySQL= mySQL & Request.Form("cZip") & "','"
mySQL= mySQL & Request.Form("cHomePh") & "','"
mySQL= mySQL & Request.Form("cBusPh") & "','"
mySQL= mySQL & Request.Form("cFax") & "','"
mySQL= mySQL & Request.Form("cQuestion") & "')"

Re: Apostrophe Errors Out Form

am 14.04.2005 06:26:44 von Jason Brown

Here's a useful link for you

http://www.aspfaq.com/show.asp?id=2035



--
Jason Brown
Microsoft GTSC, IIS

This posting is provided "AS IS" with no warranties, and confers no rights.

"PinkBishop" wrote in message
news:h7nr51pter2qejvfoegdi297bcc8jcou67@4ax.com...
> Hello All,
>
> Hope you can help.
>
> Below is the code I use to send data from form to database.
>
> Problem is if an apostrophe is entered in cQuestion field or any field
> for that matter the form errors out. Please Help.
>
>
>
> mySQL= mySQL &
> "(cEmail,cFirst,cLast,cStreet,cCity,cState,cZip,cHomePh,cBus Ph,cFax,cQuestion)"
>
> mySQL= mySQL & "VALUES ('" & Request.Form("cEmail") & "','"
> mySQL= mySQL & Request.Form("cFirst") & "'"
> mySQL= mySQL & ",'" & Request.Form("cLast") & "'"
> mySQL= mySQL & ",'" & Request.Form("cStreet") & "','"
> mySQL= mySQL & Request.Form("cCity") & "','"
> mySQL= mySQL & Request.Form("cState") & "','"
> mySQL= mySQL & Request.Form("cZip") & "','"
> mySQL= mySQL & Request.Form("cHomePh") & "','"
> mySQL= mySQL & Request.Form("cBusPh") & "','"
> mySQL= mySQL & Request.Form("cFax") & "','"
> mySQL= mySQL & Request.Form("cQuestion") & "')"

Re: Apostrophe Errors Out Form

am 14.04.2005 13:05:21 von reb01501

PinkBishop wrote:


Please do not multipost PinkBishop This is definitely a database-related
question so .asp.db was the perfect group in which to post it. Posting it at
asp.general as well did not increase your chances of getting an answer (most
of us subscribe to both groups). On the contrary, if somebody had taken his
time to answer it here, only to find that it was already resolved in the
other
group, that person may have been annoyed enough to ignore any future posts
from you, thereby decreasing your chances of getting help in the future.

There are times when you will not be sure which group is most appropriate
(again, this was not one of them), and you will want to post a question to
both groups. In that situation, you should use the cross-posting technique,
rather than posting the same message multiple times. To crosspost, put a
semicolon-delimited* list of the newsgroups to which you wish to post in the
To: header of your post and post it once. It, and any replies to it, will
appear in all the newsgroups in your list. So, if I reply in .asp.db, my
reply will also appear here in .asp.general.

* ... or whatever delimiter is recognized by your news client

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"