Re: Update SET ?
From: Bob Barrows [MVP] (reb01501_at_NOyahoo.SPAMcom)
Date: 08/30/04
- Next message: Ray Costanzo [MVP]: "Re: Update SET ?"
- Previous message: TomT: "Update SET ?"
- In reply to: TomT: "Update SET ?"
- Next in thread: Ray Costanzo [MVP]: "Re: Update SET ?"
- Messages sorted by: [ date ] [ thread ]
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.
- Next message: Ray Costanzo [MVP]: "Re: Update SET ?"
- Previous message: TomT: "Update SET ?"
- In reply to: TomT: "Update SET ?"
- Next in thread: Ray Costanzo [MVP]: "Re: Update SET ?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|