|
 |
asp_databases thread: special characters & VBScript / ASP
Message #1 by =?iso-8859-2?Q?Zsoldos_P=E9ter?= <paz@c...> on Tue, 26 Jun 2001 12:24:46 +0200
|
|
hi all,
probably already thousands of people have asked it, but I couldn't
check out the archive, so please forgive me and tell me that how can I
put characters like ' (delimeter? i am not sure about the english) into
sql queries? I mena, eg. somebody has a name like O'Brian or something
like this, how can you get that?
thanxalot!
peter
Message #2 by "Tomm Matthis" <matthis@b...> on Tue, 26 Jun 2001 08:27:59 -0400
|
|
If you're using ADO Command objects, you won't have to worry about it.
It will take care of the conversions for you.
Otherwise, double-up on the " ' " character with a replace:
strSQL =3D Replace(strSQL, "'", "''")
Thats an apostrophe surrounded by double quotes in the first parameter,
and two apostrophes surrouned by double quotes in the second parameter.
-- Tomm
> -----Original Message-----
> From: paz@c... [mailto:paz@c...]
> Sent: Tuesday, June 26, 2001 6:25 AM
> To: ASP Databases
> Subject: [asp_databases] special characters & VBScript / ASP
>
>
> hi all,
> probably already thousands of people have asked it, but I couldn't
> check out the archive, so please forgive me and tell me that how can I
> put characters like ' (delimeter? i am not sure about the english)
into
> sql queries? I mena, eg. somebody has a name like O'Brian or something
> like this, how can you get that?
> thanxalot!
>
> peter
Message #3 by raghu_hale@h... on Thu, 28 Jun 2001 11:03:34
|
|
hi if u r referring abt ASP, in ASP we have something properties for
Request object called HTMLEncode & URLEncode. I think these will server
your purpose.
Raghu
> hi all,
> probably already thousands of people have asked it, but I couldn't
> check out the archive, so please forgive me and tell me that how can I
> put characters like ' (delimeter? i am not sure about the english) into
> sql queries? I mena, eg. somebody has a name like O'Brian or something
> like this, how can you get that?
> thanxalot!
>
> peter
Message #4 by "Tomm Matthis" <matthis@b...> on Thu, 28 Jun 2001 08:37:30 -0400
|
|
Peter, if you are using strings of sql commands to do your
inserts/updates, then
replace all " ' "'s with a second one.. (i.e. double them up).
strSQL = Replace(strSQL,"'", "''")
If you use command objects instead, then you don't have to worry about
it. The command object will take care of it for you.
-- Tomm
> -----Original Message-----
> From: raghu_hale@h... [mailto:raghu_hale@h...]
> Sent: Thursday, June 28, 2001 11:04 AM
> To: ASP Databases
> Subject: [asp_databases] Re: special characters & VBScript / ASP
>
>
> hi if u r referring abt ASP, in ASP we have something properties for
> Request object called HTMLEncode & URLEncode. I think these will
server
> your purpose.
> Raghu
>
> > hi all,
> > probably already thousands of people have asked it, but I couldn't
> > check out the archive, so please forgive me and tell me that how can
I
> > put characters like ' (delimeter? i am not sure about the english)
into
> > sql queries? I mena, eg. somebody has a name like O'Brian or
something
> > like this, how can you get that?
> > thanxalot!
> >
> > peter
>
|
|
 |