[quoted text, click to view] Drew wrote:
> I am having difficulty fixing a problem with one of my apps. I know
> that using an apostrophe will error the SQL statement out, since it
> thinks that the apostrophe is the end of the statement.
That only happens if you are using dynamic sql. See here for a better
way:
http://groups-beta.google.com/group/microsoft.public.inetserver.asp.db/msg/72e36562fee7804e
[quoted text, click to view] > My issue is
> that I have replace code in my app that is *supposed* to replace the
> apostrophe with double quotes.
Do you mean two apostrophes? That's the correct way to escape single
quotes in sql statements, not double quotes
[quoted text, click to view] > This has been working fine, no
> complaints until a user tried to insert the word, does'nt (I know, it
> is spelled incorrectly, but ASP shouldn't care). The form data shows
> the line to be,
>
> StaffHowToSpendTimeWork=Name+does%27nt+like...
Huh? The user typed in "%27"?
[quoted text, click to view] >
> Now my replace code looks like this,
>
> dim StaffHowtToSpendTimeWork
> StaffHowToSpendTimeWork = Request.Form("StaffHowToSpendTimeWork")
> StaffHowtToSpendTimeWork = replace(StaffHowToSpendTimeWork,"'","''")
>
> Is there a difference between ' and %27? How can I fix this?
>
Stop doing this replacement. Use parameters.
--
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.