Bad character in URL QueryString

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Fawke101

    Bad character in URL QueryString

    Hi there,

    I have a ASP/SQL 7 application that displays data from various SQL7 Views
    onto a ASP page.

    A column of this data is displayed in ASP as hyperlinks and the relevent
    data is put into a URL query string - so that the linked page is based on
    this data ( a kind of "drill-down" effect) -

    ***
    PAGE1.asp

    <%Dim RS

    Set RS = DataConnection. Execute("SELECT col1, col2, col3 FROM view1 WHERE
    view1.col4='" & Session("listbo x1") & "'")
    do until RS.EOF
    %>

    <a href= "PAGE2.asp?col1 =<% =RS("col1")%>"> <% =RS("col1")%></a>

    ............... ......and so on
    ***

    ***
    PAGE2.asp

    Set RS = DataConnection. Execute("SELECT col1, col2, col3 FROM view2 WHERE
    view2.col4='" & request.queryst ring("col1") & "'")
    do until RS.EOF

    ............... ......you get the idea
    ***

    The problem is that a few entries in "col1" contain an apostrophy ( ' )
    which results in a bad syntax error upon clicking the hyperlink. How can i
    avoid this? without changing the SQL side of things or entering another
    column into the querystring?

    Any ideas much appreciated.
    Thanks in advance
    --
    F

    Servant of the most high God, empowered by the Holy Spirit, humbly following my savior Jesus Christ


    Please remove ANTI and SPAM from my
    email address before sending me an email.


  • Ray at

    #2
    Re: Bad character in URL QueryString

    <a href= "PAGE2.asp?col1 =<% =RS("col1")%>"> <%
    =Server.URLEnco de(RS("col1"))% ></a>

    Ray at home



    "Fawke101" <guy@ANTIbradfl ack.SPAMcom> wrote in message
    news:e9Dr28eBEH A.140@TK2MSFTNG P09.phx.gbl...
    [color=blue]
    >
    > <a href= "PAGE2.asp?col1 =<% =RS("col1")%>"> <% =RS("col1")%></a>[/color]
    [color=blue]
    > The problem is that a few entries in "col1" contain an apostrophy ( ' )
    > which results in a bad syntax error upon clicking the hyperlink. How can i
    > avoid this?[/color]


    Comment

    • Fawke101

      #3
      Re: Bad character in URL QueryString

      Thanks for that.

      However this doesnt seem to of resloved anything, only replaced the spaces
      with "+" in the displayed text and the"'" with a %27. It still comes up with
      an invalid syntax error, the URL has not changed. I have copied exactly what
      you wrote, is the sytax ok in that???

      Thanks again
      --
      F

      Servant of the most high God, empowered by the Holy Spirit, humbly following my savior Jesus Christ


      Please remove ANTI and SPAM from my
      email address before sending me an email.
      "Ray at <%=sLocation% > [MVP]" <myfirstname at lane34 dot com> wrote in
      message news:OXXPNFfBEH A.2308@tk2msftn gp13.phx.gbl...[color=blue]
      > <a href= "PAGE2.asp?col1 =<% =RS("col1")%>"> <%
      > =Server.URLEnco de(RS("col1"))% ></a>
      >
      > Ray at home
      >
      >
      >
      > "Fawke101" <guy@ANTIbradfl ack.SPAMcom> wrote in message
      > news:e9Dr28eBEH A.140@TK2MSFTNG P09.phx.gbl...
      >[color=green]
      > >
      > > <a href= "PAGE2.asp?col1 =<% =RS("col1")%>"> <% =RS("col1")%></a>[/color]
      >[color=green]
      > > The problem is that a few entries in "col1" contain an apostrophy ( ' )
      > > which results in a bad syntax error upon clicking the hyperlink. How can[/color][/color]
      i[color=blue][color=green]
      > > avoid this?[/color]
      >
      >[/color]


      Comment

      • Ray at

        #4
        Re: Bad character in URL QueryString

        When do you see the error? When you click on the link? If so, what is that
        page trying to do with the querystring? We need to see the code that is
        returning the error, an indication of on what line the error is occurring,
        and the exact error description being returned.

        Ray at home

        "Fawke101" <guy@ANTIbradfl ack.SPAMcom> wrote in message
        news:OpXxlMfBEH A.3928@TK2MSFTN GP09.phx.gbl...[color=blue]
        > Thanks for that.
        >
        > However this doesnt seem to of resloved anything, only replaced the spaces
        > with "+" in the displayed text and the"'" with a %27. It still comes up[/color]
        with[color=blue]
        > an invalid syntax error, the URL has not changed. I have copied exactly[/color]
        what[color=blue]
        > you wrote, is the sytax ok in that???
        >
        > Thanks again
        > --
        > F
        >
        > www.bradflack.com
        >
        > Please remove ANTI and SPAM from my
        > email address before sending me an email.
        > "Ray at <%=sLocation% > [MVP]" <myfirstname at lane34 dot com> wrote in
        > message news:OXXPNFfBEH A.2308@tk2msftn gp13.phx.gbl...[color=green]
        > > <a href= "PAGE2.asp?col1 =<% =RS("col1")%>"> <%
        > > =Server.URLEnco de(RS("col1"))% ></a>
        > >
        > > Ray at home
        > >
        > >
        > >
        > > "Fawke101" <guy@ANTIbradfl ack.SPAMcom> wrote in message
        > > news:e9Dr28eBEH A.140@TK2MSFTNG P09.phx.gbl...
        > >[color=darkred]
        > > >
        > > > <a href= "PAGE2.asp?col1 =<% =RS("col1")%>"> <% =RS("col1")%></a>[/color]
        > >[color=darkred]
        > > > The problem is that a few entries in "col1" contain an apostrophy ([/color][/color][/color]
        ' )[color=blue][color=green][color=darkred]
        > > > which results in a bad syntax error upon clicking the hyperlink. How[/color][/color][/color]
        can[color=blue]
        > i[color=green][color=darkred]
        > > > avoid this?[/color]
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • Fawke101

          #5
          Re: Bad character in URL QueryString

          a.. Error Type:
          Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
          [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near
          'S'.
          /location/PAGE2.asp, line 85

          Line 85 on page2.asp is as follows - It is the part where it selects data in
          relation to the querystring

          ****
          Set RS = DataConnection. Execute("SELECT col1, col2, col3 FROM view2 WHERE
          view2.col4='" & request.queryst ring("col1") & "'")
          ****

          The page is simply issuing a select statement in relation to the hyperlink
          the user clicked, as you can see.
          The error is occurring when the user clicks the hyperlink, and is only
          occurring for this particular one (all the rest work). The bad hyperlink
          (data inserted into the URL) is as follows -

          Pall Mall St James'S 1 (note the ' )

          The others look like this -

          London City DBC 1 3

          Thanks again


          --
          F

          Servant of the most high God, empowered by the Holy Spirit, humbly following my savior Jesus Christ


          Please remove ANTI and SPAM from my
          email address before sending me an email.
          "Ray at <%=sLocation% > [MVP]" <myfirstname at lane34 dot com> wrote in
          message news:#akOWSfBEH A.3308@TK2MSFTN GP10.phx.gbl...[color=blue]
          > When do you see the error? When you click on the link? If so, what is[/color]
          that[color=blue]
          > page trying to do with the querystring? We need to see the code that is
          > returning the error, an indication of on what line the error is occurring,
          > and the exact error description being returned.
          >
          > Ray at home
          >
          > "Fawke101" <guy@ANTIbradfl ack.SPAMcom> wrote in message
          > news:OpXxlMfBEH A.3928@TK2MSFTN GP09.phx.gbl...[color=green]
          > > Thanks for that.
          > >
          > > However this doesnt seem to of resloved anything, only replaced the[/color][/color]
          spaces[color=blue][color=green]
          > > with "+" in the displayed text and the"'" with a %27. It still comes up[/color]
          > with[color=green]
          > > an invalid syntax error, the URL has not changed. I have copied exactly[/color]
          > what[color=green]
          > > you wrote, is the sytax ok in that???
          > >
          > > Thanks again
          > > --
          > > F
          > >
          > > www.bradflack.com
          > >
          > > Please remove ANTI and SPAM from my
          > > email address before sending me an email.
          > > "Ray at <%=sLocation% > [MVP]" <myfirstname at lane34 dot com> wrote in
          > > message news:OXXPNFfBEH A.2308@tk2msftn gp13.phx.gbl...[color=darkred]
          > > > <a href= "PAGE2.asp?col1 =<% =RS("col1")%>"> <%
          > > > =Server.URLEnco de(RS("col1"))% ></a>
          > > >
          > > > Ray at home
          > > >
          > > >
          > > >
          > > > "Fawke101" <guy@ANTIbradfl ack.SPAMcom> wrote in message
          > > > news:e9Dr28eBEH A.140@TK2MSFTNG P09.phx.gbl...
          > > >
          > > > >
          > > > > <a href= "PAGE2.asp?col1 =<% =RS("col1")%>"> <% =RS("col1")%></a>
          > > >
          > > > > The problem is that a few entries in "col1" contain an apostrophy ([/color][/color]
          > ' )[color=green][color=darkred]
          > > > > which results in a bad syntax error upon clicking the hyperlink. How[/color][/color]
          > can[color=green]
          > > i[color=darkred]
          > > > > avoid this?
          > > >
          > > >[/color]
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • Ray at

            #6
            Re: Bad character in URL QueryString

            Any time you're dealing with text values and databases, you have to at least
            "escape" apostrophes.


            What's Pall Mall St. Jame's? I thought Pall Malls were made by Brown and
            Williamson!

            Ray at home


            "Fawke101" <guy@ANTIbradfl ack.SPAMcom> wrote in message
            news:O1MAyafBEH A.1548@TK2MSFTN GP12.phx.gbl...[color=blue]
            > a.. Error Type:
            > Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
            > [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax[/color]
            near[color=blue]
            > 'S'.
            > /location/PAGE2.asp, line 85
            >
            > Line 85 on page2.asp is as follows - It is the part where it selects data[/color]
            in[color=blue]
            > relation to the querystring
            >
            > ****
            > Set RS = DataConnection. Execute("SELECT col1, col2, col3 FROM view2 WHERE
            > view2.col4='" & request.queryst ring("col1") & "'")
            > ****
            >
            > The page is simply issuing a select statement in relation to the hyperlink
            > the user clicked, as you can see.
            > The error is occurring when the user clicks the hyperlink, and is only
            > occurring for this particular one (all the rest work). The bad hyperlink
            > (data inserted into the URL) is as follows -
            >
            > Pall Mall St James'S 1 (note the ' )
            >
            > The others look like this -
            >
            > London City DBC 1 3
            >
            > Thanks again
            >
            >
            > --
            > F
            >
            > www.bradflack.com
            >
            > Please remove ANTI and SPAM from my
            > email address before sending me an email.
            > "Ray at <%=sLocation% > [MVP]" <myfirstname at lane34 dot com> wrote in
            > message news:#akOWSfBEH A.3308@TK2MSFTN GP10.phx.gbl...[color=green]
            > > When do you see the error? When you click on the link? If so, what is[/color]
            > that[color=green]
            > > page trying to do with the querystring? We need to see the code that is
            > > returning the error, an indication of on what line the error is[/color][/color]
            occurring,[color=blue][color=green]
            > > and the exact error description being returned.
            > >
            > > Ray at home
            > >
            > > "Fawke101" <guy@ANTIbradfl ack.SPAMcom> wrote in message
            > > news:OpXxlMfBEH A.3928@TK2MSFTN GP09.phx.gbl...[color=darkred]
            > > > Thanks for that.
            > > >
            > > > However this doesnt seem to of resloved anything, only replaced the[/color][/color]
            > spaces[color=green][color=darkred]
            > > > with "+" in the displayed text and the"'" with a %27. It still comes[/color][/color][/color]
            up[color=blue][color=green]
            > > with[color=darkred]
            > > > an invalid syntax error, the URL has not changed. I have copied[/color][/color][/color]
            exactly[color=blue][color=green]
            > > what[color=darkred]
            > > > you wrote, is the sytax ok in that???
            > > >
            > > > Thanks again
            > > > --
            > > > F
            > > >
            > > > www.bradflack.com
            > > >
            > > > Please remove ANTI and SPAM from my
            > > > email address before sending me an email.
            > > > "Ray at <%=sLocation% > [MVP]" <myfirstname at lane34 dot com> wrote in
            > > > message news:OXXPNFfBEH A.2308@tk2msftn gp13.phx.gbl...
            > > > > <a href= "PAGE2.asp?col1 =<% =RS("col1")%>"> <%
            > > > > =Server.URLEnco de(RS("col1"))% ></a>
            > > > >
            > > > > Ray at home
            > > > >
            > > > >
            > > > >
            > > > > "Fawke101" <guy@ANTIbradfl ack.SPAMcom> wrote in message
            > > > > news:e9Dr28eBEH A.140@TK2MSFTNG P09.phx.gbl...
            > > > >
            > > > > >
            > > > > > <a href= "PAGE2.asp?col1 =<% =RS("col1")%>"> <% =RS("col1")%></a>
            > > > >
            > > > > > The problem is that a few entries in "col1" contain an apostrophy[/color][/color][/color]
            ([color=blue][color=green]
            > > ' )[color=darkred]
            > > > > > which results in a bad syntax error upon clicking the hyperlink.[/color][/color][/color]
            How[color=blue][color=green]
            > > can[color=darkred]
            > > > i
            > > > > > avoid this?
            > > > >
            > > > >
            > > >
            > > >[/color]
            > >
            > >[/color]
            >
            >[/color]


            Comment

            • Peter Foti

              #7
              Re: Bad character in URL QueryString

              "Fawke101" <guy@ANTIbradfl ack.SPAMcom> wrote in message
              news:O1MAyafBEH A.1548@TK2MSFTN GP12.phx.gbl...[color=blue]
              > a.. Error Type:
              > Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
              > [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax[/color]
              near[color=blue]
              > 'S'.
              > /location/PAGE2.asp, line 85
              >
              > Line 85 on page2.asp is as follows - It is the part where it selects data[/color]
              in[color=blue]
              > relation to the querystring
              >
              > ****
              > Set RS = DataConnection. Execute("SELECT col1, col2, col3 FROM view2 WHERE
              > view2.col4='" & request.queryst ring("col1") & "'")
              > ****
              >
              > The page is simply issuing a select statement in relation to the hyperlink
              > the user clicked, as you can see.
              > The error is occurring when the user clicks the hyperlink, and is only
              > occurring for this particular one (all the rest work). The bad hyperlink
              > (data inserted into the URL) is as follows -
              >
              > Pall Mall St James'S 1 (note the ' )[/color]

              Ray's suggestion was correct... you should be URL Encoding the links. But
              in your case, you also need to escape the quote before performing your SQL
              query. This explains the solution:



              Regards,
              Peter Foti


              Comment

              • Fawke101

                #8
                Re: Bad character in URL QueryString

                Ray -

                Its a <%=sLocation% > in London UK ;-)

                Im still not entirely sure what i have to do exactly, in my case, as the
                data is coming from an SQL view and i will never know what it will be, is
                there a universal way i can do this, or am i just being thick?

                Sorry, i am new to ASP and all was going so well until this..... (i need to
                be spoon fed i guess)

                Sorry again and thanks again

                --
                F

                Servant of the most high God, empowered by the Holy Spirit, humbly following my savior Jesus Christ


                Please remove ANTI and SPAM from my
                email address before sending me an email.
                "Ray at <%=sLocation% > [MVP]" <myfirstname at lane34 dot com> wrote in
                message news:et9SulfBEH A.3024@tk2msftn gp13.phx.gbl...[color=blue]
                > Any time you're dealing with text values and databases, you have to at[/color]
                least[color=blue]
                > "escape" apostrophes.
                > http://www.aspfaq.com/show.asp?id=2035
                >
                > What's Pall Mall St. Jame's? I thought Pall Malls were made by Brown and
                > Williamson!
                >
                > Ray at home
                >
                >
                > "Fawke101" <guy@ANTIbradfl ack.SPAMcom> wrote in message
                > news:O1MAyafBEH A.1548@TK2MSFTN GP12.phx.gbl...[color=green]
                > > a.. Error Type:
                > > Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
                > > [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax[/color]
                > near[color=green]
                > > 'S'.
                > > /location/PAGE2.asp, line 85
                > >
                > > Line 85 on page2.asp is as follows - It is the part where it selects[/color][/color]
                data[color=blue]
                > in[color=green]
                > > relation to the querystring
                > >
                > > ****
                > > Set RS = DataConnection. Execute("SELECT col1, col2, col3 FROM view2[/color][/color]
                WHERE[color=blue][color=green]
                > > view2.col4='" & request.queryst ring("col1") & "'")
                > > ****
                > >
                > > The page is simply issuing a select statement in relation to the[/color][/color]
                hyperlink[color=blue][color=green]
                > > the user clicked, as you can see.
                > > The error is occurring when the user clicks the hyperlink, and is only
                > > occurring for this particular one (all the rest work). The bad hyperlink
                > > (data inserted into the URL) is as follows -
                > >
                > > Pall Mall St James'S 1 (note the ' )
                > >
                > > The others look like this -
                > >
                > > London City DBC 1 3
                > >
                > > Thanks again
                > >
                > >
                > > --
                > > F
                > >
                > > www.bradflack.com
                > >
                > > Please remove ANTI and SPAM from my
                > > email address before sending me an email.
                > > "Ray at <%=sLocation% > [MVP]" <myfirstname at lane34 dot com> wrote in
                > > message news:#akOWSfBEH A.3308@TK2MSFTN GP10.phx.gbl...[color=darkred]
                > > > When do you see the error? When you click on the link? If so, what[/color][/color][/color]
                is[color=blue][color=green]
                > > that[color=darkred]
                > > > page trying to do with the querystring? We need to see the code that[/color][/color][/color]
                is[color=blue][color=green][color=darkred]
                > > > returning the error, an indication of on what line the error is[/color][/color]
                > occurring,[color=green][color=darkred]
                > > > and the exact error description being returned.
                > > >
                > > > Ray at home
                > > >
                > > > "Fawke101" <guy@ANTIbradfl ack.SPAMcom> wrote in message
                > > > news:OpXxlMfBEH A.3928@TK2MSFTN GP09.phx.gbl...
                > > > > Thanks for that.
                > > > >
                > > > > However this doesnt seem to of resloved anything, only replaced the[/color]
                > > spaces[color=darkred]
                > > > > with "+" in the displayed text and the"'" with a %27. It still comes[/color][/color]
                > up[color=green][color=darkred]
                > > > with
                > > > > an invalid syntax error, the URL has not changed. I have copied[/color][/color]
                > exactly[color=green][color=darkred]
                > > > what
                > > > > you wrote, is the sytax ok in that???
                > > > >
                > > > > Thanks again
                > > > > --
                > > > > F
                > > > >
                > > > > www.bradflack.com
                > > > >
                > > > > Please remove ANTI and SPAM from my
                > > > > email address before sending me an email.
                > > > > "Ray at <%=sLocation% > [MVP]" <myfirstname at lane34 dot com> wrote[/color][/color][/color]
                in[color=blue][color=green][color=darkred]
                > > > > message news:OXXPNFfBEH A.2308@tk2msftn gp13.phx.gbl...
                > > > > > <a href= "PAGE2.asp?col1 =<% =RS("col1")%>"> <%
                > > > > > =Server.URLEnco de(RS("col1"))% ></a>
                > > > > >
                > > > > > Ray at home
                > > > > >
                > > > > >
                > > > > >
                > > > > > "Fawke101" <guy@ANTIbradfl ack.SPAMcom> wrote in message
                > > > > > news:e9Dr28eBEH A.140@TK2MSFTNG P09.phx.gbl...
                > > > > >
                > > > > > >
                > > > > > > <a href= "PAGE2.asp?col1 =<% =RS("col1")%>"> <% =RS("col1")%></a>
                > > > > >
                > > > > > > The problem is that a few entries in "col1" contain an[/color][/color][/color]
                apostrophy[color=blue]
                > ([color=green][color=darkred]
                > > > ' )
                > > > > > > which results in a bad syntax error upon clicking the hyperlink.[/color][/color]
                > How[color=green][color=darkred]
                > > > can
                > > > > i
                > > > > > > avoid this?
                > > > > >
                > > > > >
                > > > >
                > > > >
                > > >
                > > >[/color]
                > >
                > >[/color]
                >
                >[/color]


                Comment

                • Ray at

                  #9
                  Re: Bad character in URL QueryString

                  Did you read that page at all?

                  sql = "SELECT col1, col2, col3 FROM view2 WHERE view2.col4='" &
                  Replace(request .querystring("c ol1"), "'", "''") & "'"
                  Set RS = DataConnection. Execute(sql)

                  Ray at home


                  "Fawke101" <guy@ANTIbradfl ack.SPAMcom> wrote in message
                  news:%23WQ6fvfB EHA.1380@TK2MSF TNGP10.phx.gbl. ..[color=blue]
                  > Ray -
                  >
                  > Its a <%=sLocation% > in London UK ;-)
                  >
                  > Im still not entirely sure what i have to do exactly, in my case, as the
                  > data is coming from an SQL view and i will never know what it will be, is
                  > there a universal way i can do this, or am i just being thick?
                  >
                  > Sorry, i am new to ASP and all was going so well until this..... (i need[/color]
                  to[color=blue]
                  > be spoon fed i guess)
                  >
                  > Sorry again and thanks again
                  >
                  > --
                  > F
                  >
                  > www.bradflack.com
                  >
                  > Please remove ANTI and SPAM from my
                  > email address before sending me an email.
                  > "Ray at <%=sLocation% > [MVP]" <myfirstname at lane34 dot com> wrote in
                  > message news:et9SulfBEH A.3024@tk2msftn gp13.phx.gbl...[color=green]
                  > > Any time you're dealing with text values and databases, you have to at[/color]
                  > least[color=green]
                  > > "escape" apostrophes.
                  > > http://www.aspfaq.com/show.asp?id=2035
                  > >
                  > > What's Pall Mall St. Jame's? I thought Pall Malls were made by Brown[/color][/color]
                  and[color=blue][color=green]
                  > > Williamson!
                  > >
                  > > Ray at home
                  > >
                  > >
                  > > "Fawke101" <guy@ANTIbradfl ack.SPAMcom> wrote in message
                  > > news:O1MAyafBEH A.1548@TK2MSFTN GP12.phx.gbl...[color=darkred]
                  > > > a.. Error Type:
                  > > > Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
                  > > > [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect[/color][/color][/color]
                  syntax[color=blue][color=green]
                  > > near[color=darkred]
                  > > > 'S'.
                  > > > /location/PAGE2.asp, line 85
                  > > >
                  > > > Line 85 on page2.asp is as follows - It is the part where it selects[/color][/color]
                  > data[color=green]
                  > > in[color=darkred]
                  > > > relation to the querystring
                  > > >
                  > > > ****
                  > > > Set RS = DataConnection. Execute("SELECT col1, col2, col3 FROM view2[/color][/color]
                  > WHERE[color=green][color=darkred]
                  > > > view2.col4='" & request.queryst ring("col1") & "'")
                  > > > ****
                  > > >
                  > > > The page is simply issuing a select statement in relation to the[/color][/color]
                  > hyperlink[color=green][color=darkred]
                  > > > the user clicked, as you can see.
                  > > > The error is occurring when the user clicks the hyperlink, and is only
                  > > > occurring for this particular one (all the rest work). The bad[/color][/color][/color]
                  hyperlink[color=blue][color=green][color=darkred]
                  > > > (data inserted into the URL) is as follows -
                  > > >
                  > > > Pall Mall St James'S 1 (note the ' )
                  > > >
                  > > > The others look like this -
                  > > >
                  > > > London City DBC 1 3
                  > > >
                  > > > Thanks again
                  > > >
                  > > >
                  > > > --
                  > > > F
                  > > >
                  > > > www.bradflack.com
                  > > >
                  > > > Please remove ANTI and SPAM from my
                  > > > email address before sending me an email.
                  > > > "Ray at <%=sLocation% > [MVP]" <myfirstname at lane34 dot com> wrote in
                  > > > message news:#akOWSfBEH A.3308@TK2MSFTN GP10.phx.gbl...
                  > > > > When do you see the error? When you click on the link? If so, what[/color][/color]
                  > is[color=green][color=darkred]
                  > > > that
                  > > > > page trying to do with the querystring? We need to see the code[/color][/color][/color]
                  that[color=blue]
                  > is[color=green][color=darkred]
                  > > > > returning the error, an indication of on what line the error is[/color]
                  > > occurring,[color=darkred]
                  > > > > and the exact error description being returned.
                  > > > >
                  > > > > Ray at home
                  > > > >
                  > > > > "Fawke101" <guy@ANTIbradfl ack.SPAMcom> wrote in message
                  > > > > news:OpXxlMfBEH A.3928@TK2MSFTN GP09.phx.gbl...
                  > > > > > Thanks for that.
                  > > > > >
                  > > > > > However this doesnt seem to of resloved anything, only replaced[/color][/color][/color]
                  the[color=blue][color=green][color=darkred]
                  > > > spaces
                  > > > > > with "+" in the displayed text and the"'" with a %27. It still[/color][/color][/color]
                  comes[color=blue][color=green]
                  > > up[color=darkred]
                  > > > > with
                  > > > > > an invalid syntax error, the URL has not changed. I have copied[/color]
                  > > exactly[color=darkred]
                  > > > > what
                  > > > > > you wrote, is the sytax ok in that???
                  > > > > >
                  > > > > > Thanks again
                  > > > > > --
                  > > > > > F
                  > > > > >
                  > > > > > www.bradflack.com
                  > > > > >
                  > > > > > Please remove ANTI and SPAM from my
                  > > > > > email address before sending me an email.
                  > > > > > "Ray at <%=sLocation% > [MVP]" <myfirstname at lane34 dot com>[/color][/color][/color]
                  wrote[color=blue]
                  > in[color=green][color=darkred]
                  > > > > > message news:OXXPNFfBEH A.2308@tk2msftn gp13.phx.gbl...
                  > > > > > > <a href= "PAGE2.asp?col1 =<% =RS("col1")%>"> <%
                  > > > > > > =Server.URLEnco de(RS("col1"))% ></a>
                  > > > > > >
                  > > > > > > Ray at home
                  > > > > > >
                  > > > > > >
                  > > > > > >
                  > > > > > > "Fawke101" <guy@ANTIbradfl ack.SPAMcom> wrote in message
                  > > > > > > news:e9Dr28eBEH A.140@TK2MSFTNG P09.phx.gbl...
                  > > > > > >
                  > > > > > > >
                  > > > > > > > <a href= "PAGE2.asp?col1 =<% =RS("col1")%>"> <%[/color][/color][/color]
                  =RS("col1")%></a>[color=blue][color=green][color=darkred]
                  > > > > > >
                  > > > > > > > The problem is that a few entries in "col1" contain an[/color][/color]
                  > apostrophy[color=green]
                  > > ([color=darkred]
                  > > > > ' )
                  > > > > > > > which results in a bad syntax error upon clicking the[/color][/color][/color]
                  hyperlink.[color=blue][color=green]
                  > > How[color=darkred]
                  > > > > can
                  > > > > > i
                  > > > > > > > avoid this?
                  > > > > > >
                  > > > > > >
                  > > > > >
                  > > > > >
                  > > > >
                  > > > >
                  > > >
                  > > >[/color]
                  > >
                  > >[/color]
                  >
                  >[/color]


                  Comment

                  • Fawke101

                    #10
                    Re: Bad character in URL QueryString

                    nope, still no joy, i did read that page, just couldnt implement it......

                    il keep trying

                    --
                    F

                    Servant of the most high God, empowered by the Holy Spirit, humbly following my savior Jesus Christ


                    Please remove ANTI and SPAM from my
                    email address before sending me an email.
                    "Ray at <%=sLocation% > [MVP]" <myfirstname at lane34 dot com> wrote in
                    message news:#UbnpxfBEH A.892@TK2MSFTNG P09.phx.gbl...[color=blue]
                    > Did you read that page at all?
                    >
                    > sql = "SELECT col1, col2, col3 FROM view2 WHERE view2.col4='" &
                    > Replace(request .querystring("c ol1"), "'", "''") & "'"
                    > Set RS = DataConnection. Execute(sql)
                    >
                    > Ray at home
                    >
                    >
                    > "Fawke101" <guy@ANTIbradfl ack.SPAMcom> wrote in message
                    > news:%23WQ6fvfB EHA.1380@TK2MSF TNGP10.phx.gbl. ..[color=green]
                    > > Ray -
                    > >
                    > > Its a <%=sLocation% > in London UK ;-)
                    > >
                    > > Im still not entirely sure what i have to do exactly, in my case, as the
                    > > data is coming from an SQL view and i will never know what it will be,[/color][/color]
                    is[color=blue][color=green]
                    > > there a universal way i can do this, or am i just being thick?
                    > >
                    > > Sorry, i am new to ASP and all was going so well until this..... (i need[/color]
                    > to[color=green]
                    > > be spoon fed i guess)
                    > >
                    > > Sorry again and thanks again
                    > >
                    > > --
                    > > F
                    > >
                    > > www.bradflack.com
                    > >
                    > > Please remove ANTI and SPAM from my
                    > > email address before sending me an email.
                    > > "Ray at <%=sLocation% > [MVP]" <myfirstname at lane34 dot com> wrote in
                    > > message news:et9SulfBEH A.3024@tk2msftn gp13.phx.gbl...[color=darkred]
                    > > > Any time you're dealing with text values and databases, you have to at[/color]
                    > > least[color=darkred]
                    > > > "escape" apostrophes.
                    > > > http://www.aspfaq.com/show.asp?id=2035
                    > > >
                    > > > What's Pall Mall St. Jame's? I thought Pall Malls were made by Brown[/color][/color]
                    > and[color=green][color=darkred]
                    > > > Williamson!
                    > > >
                    > > > Ray at home
                    > > >
                    > > >
                    > > > "Fawke101" <guy@ANTIbradfl ack.SPAMcom> wrote in message
                    > > > news:O1MAyafBEH A.1548@TK2MSFTN GP12.phx.gbl...
                    > > > > a.. Error Type:
                    > > > > Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
                    > > > > [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect[/color][/color]
                    > syntax[color=green][color=darkred]
                    > > > near
                    > > > > 'S'.
                    > > > > /location/PAGE2.asp, line 85
                    > > > >
                    > > > > Line 85 on page2.asp is as follows - It is the part where it selects[/color]
                    > > data[color=darkred]
                    > > > in
                    > > > > relation to the querystring
                    > > > >
                    > > > > ****
                    > > > > Set RS = DataConnection. Execute("SELECT col1, col2, col3 FROM view2[/color]
                    > > WHERE[color=darkred]
                    > > > > view2.col4='" & request.queryst ring("col1") & "'")
                    > > > > ****
                    > > > >
                    > > > > The page is simply issuing a select statement in relation to the[/color]
                    > > hyperlink[color=darkred]
                    > > > > the user clicked, as you can see.
                    > > > > The error is occurring when the user clicks the hyperlink, and is[/color][/color][/color]
                    only[color=blue][color=green][color=darkred]
                    > > > > occurring for this particular one (all the rest work). The bad[/color][/color]
                    > hyperlink[color=green][color=darkred]
                    > > > > (data inserted into the URL) is as follows -
                    > > > >
                    > > > > Pall Mall St James'S 1 (note the ' )
                    > > > >
                    > > > > The others look like this -
                    > > > >
                    > > > > London City DBC 1 3
                    > > > >
                    > > > > Thanks again
                    > > > >
                    > > > >
                    > > > > --
                    > > > > F
                    > > > >
                    > > > > www.bradflack.com
                    > > > >
                    > > > > Please remove ANTI and SPAM from my
                    > > > > email address before sending me an email.
                    > > > > "Ray at <%=sLocation% > [MVP]" <myfirstname at lane34 dot com> wrote[/color][/color][/color]
                    in[color=blue][color=green][color=darkred]
                    > > > > message news:#akOWSfBEH A.3308@TK2MSFTN GP10.phx.gbl...
                    > > > > > When do you see the error? When you click on the link? If so,[/color][/color][/color]
                    what[color=blue][color=green]
                    > > is[color=darkred]
                    > > > > that
                    > > > > > page trying to do with the querystring? We need to see the code[/color][/color]
                    > that[color=green]
                    > > is[color=darkred]
                    > > > > > returning the error, an indication of on what line the error is
                    > > > occurring,
                    > > > > > and the exact error description being returned.
                    > > > > >
                    > > > > > Ray at home
                    > > > > >
                    > > > > > "Fawke101" <guy@ANTIbradfl ack.SPAMcom> wrote in message
                    > > > > > news:OpXxlMfBEH A.3928@TK2MSFTN GP09.phx.gbl...
                    > > > > > > Thanks for that.
                    > > > > > >
                    > > > > > > However this doesnt seem to of resloved anything, only replaced[/color][/color]
                    > the[color=green][color=darkred]
                    > > > > spaces
                    > > > > > > with "+" in the displayed text and the"'" with a %27. It still[/color][/color]
                    > comes[color=green][color=darkred]
                    > > > up
                    > > > > > with
                    > > > > > > an invalid syntax error, the URL has not changed. I have copied
                    > > > exactly
                    > > > > > what
                    > > > > > > you wrote, is the sytax ok in that???
                    > > > > > >
                    > > > > > > Thanks again
                    > > > > > > --
                    > > > > > > F
                    > > > > > >
                    > > > > > > www.bradflack.com
                    > > > > > >
                    > > > > > > Please remove ANTI and SPAM from my
                    > > > > > > email address before sending me an email.
                    > > > > > > "Ray at <%=sLocation% > [MVP]" <myfirstname at lane34 dot com>[/color][/color]
                    > wrote[color=green]
                    > > in[color=darkred]
                    > > > > > > message news:OXXPNFfBEH A.2308@tk2msftn gp13.phx.gbl...
                    > > > > > > > <a href= "PAGE2.asp?col1 =<% =RS("col1")%>"> <%
                    > > > > > > > =Server.URLEnco de(RS("col1"))% ></a>
                    > > > > > > >
                    > > > > > > > Ray at home
                    > > > > > > >
                    > > > > > > >
                    > > > > > > >
                    > > > > > > > "Fawke101" <guy@ANTIbradfl ack.SPAMcom> wrote in message
                    > > > > > > > news:e9Dr28eBEH A.140@TK2MSFTNG P09.phx.gbl...
                    > > > > > > >
                    > > > > > > > >
                    > > > > > > > > <a href= "PAGE2.asp?col1 =<% =RS("col1")%>"> <%[/color][/color]
                    > =RS("col1")%></a>[color=green][color=darkred]
                    > > > > > > >
                    > > > > > > > > The problem is that a few entries in "col1" contain an[/color]
                    > > apostrophy[color=darkred]
                    > > > (
                    > > > > > ' )
                    > > > > > > > > which results in a bad syntax error upon clicking the[/color][/color]
                    > hyperlink.[color=green][color=darkred]
                    > > > How
                    > > > > > can
                    > > > > > > i
                    > > > > > > > > avoid this?
                    > > > > > > >
                    > > > > > > >
                    > > > > > >
                    > > > > > >
                    > > > > >
                    > > > > >
                    > > > >
                    > > > >
                    > > >
                    > > >[/color]
                    > >
                    > >[/color]
                    >
                    >[/color]


                    Comment

                    Working...