html special characters and database problems, arg!

Discussion in 'ASP General' started by John, Feb 6, 2005.

  1. John

    John Guest

    I am having problems with special characters with database calls (if I'm
    referring to this in the right way). the problem is with apostrophes of all
    things. If an end user puts an apostrophe in something ASP will interprete
    it as a delimiter. This is aggravating because I'm trying to make this as
    simple for the end user as possible and if they can't place something in a
    simple text field like "Joe's Bar" (which comes out as "Joe") then I have a
    problem because I don't have a solution for this. It appears that this "
    ´ " is not quite the same as " ' " and I don't see a special
    character for apostrophes either.

    This seems like a real pain in kee for something as small as this but it
    confuses end users to not be able to write simple english.
     
    John, Feb 6, 2005
    #1
    1. Advertising

  2. John

    Steven Burn Guest

    strMyQuery = Replace(Request.Form("txtSomeField"), "'", "")

    Or

    strMyQuery = Replace(Request.Form("txtSomeField"), "'", """)

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group
    www.it-mate.co.uk

    Keeping it FREE!

    "John" <> wrote in message
    news:2muNd.31759$...
    > I am having problems with special characters with database calls (if I'm
    > referring to this in the right way). the problem is with apostrophes of

    all
    > things. If an end user puts an apostrophe in something ASP will

    interprete
    > it as a delimiter. This is aggravating because I'm trying to make this as
    > simple for the end user as possible and if they can't place something in a
    > simple text field like "Joe's Bar" (which comes out as "Joe") then I have

    a
    > problem because I don't have a solution for this. It appears that this "
    > &acute; " is not quite the same as " ' " and I don't see a special
    > character for apostrophes either.
    >
    > This seems like a real pain in kee for something as small as this but it
    > confuses end users to not be able to write simple english.
    >
    >
     
    Steven Burn, Feb 6, 2005
    #2
    1. Advertising

  3. Or
    strMyQuery = Replace(Request.Form("txtSomeField"), "'", "''")
    will keep the apostrophe in the string...

    Or, best yet, use parameterized queries through the ADODB.Command object...

    http://www.4guysfromrolla.com/webtech/021799-1.shtml
    http://www.4guysfromrolla.com/webtech/111798-1.shtml
    http://www.allfreetech.com/ShowMain.asp?MainID=108&p=1


    Steven Burn wrote:
    > strMyQuery = Replace(Request.Form("txtSomeField"), "'", "")
    >
    > Or
    >
    > strMyQuery = Replace(Request.Form("txtSomeField"), "'", """)
    >
    > --
    > Regards
    >
    > Steven Burn
    > Ur I.T. Mate Group
    > www.it-mate.co.uk
    >
    > Keeping it FREE!
    >
    > "John" <> wrote in message
    > news:2muNd.31759$...
    >
    >>I am having problems with special characters with database calls (if I'm
    >>referring to this in the right way). the problem is with apostrophes of

    >
    > all
    >
    >>things. If an end user puts an apostrophe in something ASP will

    >
    > interprete
    >
    >>it as a delimiter. This is aggravating because I'm trying to make this as
    >>simple for the end user as possible and if they can't place something in a
    >>simple text field like "Joe's Bar" (which comes out as "Joe") then I have

    >
    > a
    >
    >>problem because I don't have a solution for this. It appears that this "
    >>&acute; " is not quite the same as " ' " and I don't see a special
    >>character for apostrophes either.
    >>
    >>This seems like a real pain in kee for something as small as this but it
    >>confuses end users to not be able to write simple english.
     
    Blair Bonnett, Feb 6, 2005
    #3
  4. John wrote:
    > I am having problems with special characters with database calls (if
    > I'm referring to this in the right way). the problem is with
    > apostrophes of all things. If an end user puts an apostrophe in
    > something ASP will interprete it as a delimiter. This is aggravating
    > because I'm trying to make this as simple for the end user as
    > possible and if they can't place something in a simple text field
    > like "Joe's Bar" (which comes out as "Joe") then I have a problem
    > because I don't have a solution for this. It appears that this "
    > &acute; " is not quite the same as " ' " and I don't see a
    > special character for apostrophes either.
    >
    > This seems like a real pain in kee for something as small as this but
    > it confuses end users to not be able to write simple english.


    Yes. Delimiters are a pain, aren't they? That's why I think it is a crime
    that newbies are taught the wrong way (dynamic sql) before the right way
    (stored procedures, passing parameters). You did not tell us what database
    you are using so:

    http://www.google.com/groups?hl=en&...&hl=en&lr=&ie=UTF-8&oe=UTF-8&start=10&sa=NBob Barrows--Microsoft MVP - ASP/ASP.NETPlease reply to the newsgroup. This email account is my spam trap so Idon't check it very often. If you must reply off-line, then remove the"NO SPAM"
     
    Bob Barrows [MVP], Feb 7, 2005
    #4
  5. John

    Steven Burn Guest

    Bob hehe, the URL is majorly invalid <vbg>

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group
    www.it-mate.co.uk

    Keeping it FREE!

    "Bob Barrows [MVP]" <> wrote in message
    news:##...
    > John wrote:
    > > I am having problems with special characters with database calls (if
    > > I'm referring to this in the right way). the problem is with
    > > apostrophes of all things. If an end user puts an apostrophe in
    > > something ASP will interprete it as a delimiter. This is aggravating
    > > because I'm trying to make this as simple for the end user as
    > > possible and if they can't place something in a simple text field
    > > like "Joe's Bar" (which comes out as "Joe") then I have a problem
    > > because I don't have a solution for this. It appears that this "
    > > &acute; " is not quite the same as " ' " and I don't see a
    > > special character for apostrophes either.
    > >
    > > This seems like a real pain in kee for something as small as this but
    > > it confuses end users to not be able to write simple english.

    >
    > Yes. Delimiters are a pain, aren't they? That's why I think it is a crime
    > that newbies are taught the wrong way (dynamic sql) before the right way
    > (stored procedures, passing parameters). You did not tell us what database
    > you are using so:
    >
    >

    http://www.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=e6lLVvOcDHA.12
    04%40TK2MSFTNGP12.phx.gblhttp://www.google.com/groups?hl=en&lr=&ie=UTF-8&oe=
    UTF-8&threadm=3bc06369.4904372%40news.charter.net&rnum=4&prev=/groups%3Fas_q
    %3Ddelimiter%26safe%3Dimages%26ie%3DUTF-8%26oe%3DUTF-8%26as_uauthors%3DBob%2
    520Barrows%26lr%3D%26hl%3Denhttp://tinyurl.com/jyy0http://www.google.com/gro
    ups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=O31NZa%230DHA.3436%40tk2msftngp13.ph
    x.gbl&rnum=11&prev=/groups%3Fq%3Ddelimiter%2Bauthor:Bob%2Bauthor:Barrows%26h
    l%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26start%3D10%26sa%3DNBob
    Barrows--Microsoft MVP - ASP/ASP.NETPlease reply to the newsgroup. This
    email account is my spam trap so Idon't check it very often. If you must
    reply off-line, then remove the"NO SPAM"
    >
     
    Steven Burn, Feb 7, 2005
    #5
  6. John

    Adrienne Guest

    Gazing into my crystal ball I observed "Steven Burn"
    <> writing in
    news:#:

    > Bob hehe, the URL is majorly invalid <vbg>
    >


    But the Tiny URL is - http://tinyurl.com/jyy0

    >
    > "Bob Barrows [MVP]" <> wrote in message
    > news:##...
    >> John wrote:
    >> > I am having problems with special characters with database calls (if
    >> > I'm referring to this in the right way). the problem is with
    >> > apostrophes of all things. If an end user puts an apostrophe in
    >> > something ASP will interprete it as a delimiter. This is
    >> > aggravating because I'm trying to make this as simple for the end
    >> > user as possible and if they can't place something in a simple text
    >> > field like "Joe's Bar" (which comes out as "Joe") then I have a
    >> > problem because I don't have a solution for this. It appears that
    >> > this " &acute; " is not quite the same as " ' " and I don't see
    >> > a special character for apostrophes either.
    >> >
    >> > This seems like a real pain in kee for something as small as this
    >> > but it confuses end users to not be able to write simple english.

    >>
    >> Yes. Delimiters are a pain, aren't they? That's why I think it is a
    >> crime that newbies are taught the wrong way (dynamic sql) before the
    >> right way (stored procedures, passing parameters). You did not tell us
    >> what database you are using so:
    >>
    >>

    > http://www.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=e6lLVvOcDH
    > A.12
    > 04%40TK2MSFTNGP12.phx.gblhttp://www.google.com/groups?hl=en&lr=&ie=UTF-8
    > &oe=
    > UTF-8&threadm=3bc06369.4904372%40news.charter.net&rnum=4&prev=/groups%3F
    > as_q
    > %3Ddelimiter%26safe%3Dimages%26ie%3DUTF-8%26oe%3DUTF-8%26as_uauthors%3DB
    > ob%2
    > 520Barrows%26lr%3D%26hl%3Denhttp://tinyurl.com/jyy0http://www.google.com
    > /gro
    > ups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=O31NZa%230DHA.3436%40tk2msftngp1
    > 3.ph
    > x.gbl&rnum=11&prev=/groups%3Fq%3Ddelimiter%2Bauthor:Bob%2Bauthor:Barrows
    > %26h l%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26start%3D10%26sa%3DNBob
    > Barrows--Microsoft MVP - ASP/ASP.NETPlease reply to the newsgroup. This
    > email account is my spam trap so Idon't check it very often. If you
    > must reply off-line, then remove the"NO SPAM"
    >>

    >
    >




    --
    Adrienne Boswell
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
     
    Adrienne, Feb 7, 2005
    #6
  7. John

    Steven Burn Guest

    <g> that'll work too .... cheers ;o)

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group
    www.it-mate.co.uk

    Keeping it FREE!

    "Adrienne" <> wrote in message
    news:Xns95F62EC892493arbpenyahoocom@207.115.63.158...
    > Gazing into my crystal ball I observed "Steven Burn"
    > <> writing in
    > news:#:
    >
    > > Bob hehe, the URL is majorly invalid <vbg>
    > >

    >
    > But the Tiny URL is - http://tinyurl.com/jyy0
    >
    > >
    > > "Bob Barrows [MVP]" <> wrote in message
    > > news:##...
    > >> John wrote:
    > >> > I am having problems with special characters with database calls (if
    > >> > I'm referring to this in the right way). the problem is with
    > >> > apostrophes of all things. If an end user puts an apostrophe in
    > >> > something ASP will interprete it as a delimiter. This is
    > >> > aggravating because I'm trying to make this as simple for the end
    > >> > user as possible and if they can't place something in a simple text
    > >> > field like "Joe's Bar" (which comes out as "Joe") then I have a
    > >> > problem because I don't have a solution for this. It appears that
    > >> > this " &acute; " is not quite the same as " ' " and I don't see
    > >> > a special character for apostrophes either.
    > >> >
    > >> > This seems like a real pain in kee for something as small as this
    > >> > but it confuses end users to not be able to write simple english.
    > >>
    > >> Yes. Delimiters are a pain, aren't they? That's why I think it is a
    > >> crime that newbies are taught the wrong way (dynamic sql) before the
    > >> right way (stored procedures, passing parameters). You did not tell us
    > >> what database you are using so:
    > >>
    > >>

    > > http://www.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=e6lLVvOcDH
    > > A.12
    > > 04%40TK2MSFTNGP12.phx.gblhttp://www.google.com/groups?hl=en&lr=&ie=UTF-8
    > > &oe=
    > > UTF-8&threadm=3bc06369.4904372%40news.charter.net&rnum=4&prev=/groups%3F


    > > as_q
    > > %3Ddelimiter%26safe%3Dimages%26ie%3DUTF-8%26oe%3DUTF-8%26as_uauthors%3DB
    > > ob%2
    > > 520Barrows%26lr%3D%26hl%3Denhttp://tinyurl.com/jyy0http://www.google.com
    > > /gro
    > > ups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=O31NZa%230DHA.3436%40tk2msftngp1
    > > 3.ph
    > > x.gbl&rnum=11&prev=/groups%3Fq%3Ddelimiter%2Bauthor:Bob%2Bauthor:Barrows
    > > %26h l%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26start%3D10%26sa%3DNBob
    > > Barrows--Microsoft MVP - ASP/ASP.NETPlease reply to the newsgroup. This
    > > email account is my spam trap so Idon't check it very often. If you
    > > must reply off-line, then remove the"NO SPAM"
    > >>

    > >
    > >

    >
    >
    >
    > --
    > Adrienne Boswell
    > http://www.cavalcade-of-coding.info
    > Please respond to the group so others can share
     
    Steven Burn, Feb 7, 2005
    #7
  8. Bob Barrows [MVP] wrote:
    > John wrote:
    >> I am having problems with special characters with database calls (if
    >> I'm referring to this in the right way). the problem is with
    >> apostrophes of all things. If an end user puts an apostrophe in
    >> something ASP will interprete it as a delimiter. This is aggravating
    >> because I'm trying to make this as simple for the end user as
    >> possible and if they can't place something in a simple text field
    >> like "Joe's Bar" (which comes out as "Joe") then I have a problem
    >> because I don't have a solution for this. It appears that this "
    >> &acute; " is not quite the same as " ' " and I don't see a
    >> special character for apostrophes either.
    >>
    >> This seems like a real pain in kee for something as small as this but
    >> it confuses end users to not be able to write simple english.

    >
    > Yes. Delimiters are a pain, aren't they? That's why I think it is a
    > crime
    > that newbies are taught the wrong way (dynamic sql) before the right
    > way (stored procedures, passing parameters). You did not tell us what
    > database
    > you are using so:
    >
    >

    http://www.google.com/groups?hl=en&...&hl=en&lr=&ie=UTF-8&oe=UTF-8&start=10&sa=NBob


    I do not understand what happened to the line breaks. Let's try again:

    http://www.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=

    http://www.google.com/groups?hl=en&...t&rnum=4&prev=/groups?as_q=delimiter&safe=ima
    ges%26ie%3DUTF-8%26oe%3DUTF-8%26as_uauthors%3DBob%2520Barrows%26lr%3D%26hl%3
    Den

    http://tinyurl.com/jyy0

    http://www.google.com/groups?hl=en&...ows&hl=en&lr=&ie=UTF-8&oe=UTF-8&start=10&sa=N


    --
    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.
     
    Bob Barrows [MVP], Feb 7, 2005
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stefan Mueller
    Replies:
    3
    Views:
    33,318
    Stefan Mueller
    Jul 23, 2006
  2. rvino
    Replies:
    0
    Views:
    4,723
    rvino
    Aug 14, 2007
  3. n00m
    Replies:
    5
    Views:
    413
  4. Replies:
    7
    Views:
    205
  5. Replies:
    21
    Views:
    429
    Barry Schwarz
    Mar 5, 2014
Loading...

Share This Page