Re: Update SET ?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Bob Barrows [MVP] (reb01501_at_NOyahoo.SPAMcom)
Date: 08/30/04


Date: Mon, 30 Aug 2004 15:24:21 -0400

TomT wrote:
> Taking data from a form, and using UPDATE tablename SET
>
> Seems to be working fine... EXCEPT..
>
> Certain characters cause an error when the update happens.
>
> These include:
> ' "
>
> ' causes an SQL error (Syntax error (missing operator) in query
> expression)
>
> " data after or between the "" is not displayed..
>
> How do I trap these ? and stop these errors ?
>
> Thanks

Assuming you are using dynamic sql (not recommended), use Replace() to
double up the single quote character. Characters are "escaped" by doubling
them up. The escaped characters are automatically converted into the single
literal character when the string is processed.

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

This whole issue can be avoided (along with preventing SQL Injection) y
passing data via parameters.

Bob Barrows

-- 
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


Relevant Pages

  • Update SET ?
    ... and using UPDATE tablename SET ... Certain characters cause an error when the update happens. ... ' causes an SQL error in query expression) ... How do I trap these? ...
    (microsoft.public.inetserver.asp.db)
  • Re: Ligatures [was: Re: The -s plural in English nouns]
    ... Agent newsgroup where you could raise the point and see if ... ASCII characters, either of the things you've mentioned ... I never said anything about my using Lynx; ... commenting on with respect to looking in an Agent newsgroup ...
    (alt.usage.english)
  • Re: How to Limit Memo to 1500 Characters
    ... Something like "Please enter less than 1500 characters." ... In Design view, select the memo field. ... Now if you wish to use a Validation rule you can. ... Please respond only to this newsgroup. ...
    (microsoft.public.access.forms)
  • Re: Different number of Chinese characters per line in MS Word
    ... You may want to use the link below to also post this in the Word International Features newsgroup. ... I have a MS Word 2000 document in Chinese characters. ... characters as the original document, even though all format settings in two ...
    (microsoft.public.office.misc)
  • Re: Re: LAW requires 10-pitch
    ... average number of characters per line and by 6 to derive the cpi. ... please post all follow-ups to the newsgroup so ... > This is the rule for proportional spaced fonts -- it needs to average ... >>incoming briefs to make sure they meet formatting requirements. ...
    (microsoft.public.word.printingfonts)