Querystring issue with the + sign separator

Hi All,

I have a querystring that contains the + sign as a separator, I need to read
these values individually in a select statement, for example.

&text=Single+205

where single is the type of room somebody wants and 205 is the user ID in
the Customer table.

Please help.

Regards
Simon
Simon Gare [ Di, 23 Oktober 2007 14:05 ] [ ID #1852362 ]

Re: Querystring issue with the + sign separator

"Simon Gare" <simon [at] simongare.com> wrote in message
news:%23sFGG0WFIHA.1168 [at] TK2MSFTNGP02.phx.gbl...
> Hi All,
>
> I have a querystring that contains the + sign as a separator, I need to
read
> these values individually in a select statement, for example.
>
> &text=Single+205
>
> where single is the type of room somebody wants and 205 is the user ID in
> the Customer table.
>
> Please help.
>

I include the following for academic reasons.

<do not use>
The + will be considered an escape character for space hence the code:-

Dim sText : sText = Request.QueryString("text")

Will put the string "Single 205" in the variable sText. The split function
can be used to get the separate values:-

Dim asText : asText = Split(sText, " ")

Now asText(0) is "Single" and asText(1) is "205"

</do not use>

However encoding two distinct pieces of data into a single value is not
sensible. Better would be:-

&type=Single&userid 5

Now the code is:-

Dim sType : sType = Request.QueryString("type")
Dim lUserID : lUserID = CLng(Request.QueryString("userid")


--
Anthony Jones - MVP ASP/ASP.NET
Anthony Jones [ Di, 23 Oktober 2007 14:42 ] [ ID #1852364 ]

Re: Querystring issue with the + sign separator

"Simon Gare" <simon [at] simongare.com> wrote in message
news:#sFGG0WFIHA.1168 [at] TK2MSFTNGP02.phx.gbl...
> Hi All,
>
> I have a querystring that contains the + sign as a separator, I need to
read
> these values individually in a select statement, for example.
>
> &text=Single+205
>
> where single is the type of room somebody wants and 205 is the user ID in
> the Customer table.

http://www.aspfaq.com/5003
McKirahan [ Di, 23 Oktober 2007 14:59 ] [ ID #1852365 ]

Re: Querystring issue with the + sign separator

Anthony thanks for that will give it a go.

Regards
Simon
Simon Gare [ Di, 23 Oktober 2007 14:53 ] [ ID #1852366 ]
Webserver » microsoft.public.inetserver.asp.general » Querystring issue with the + sign separator

Vorheriges Thema: ASP: XLS to XML
Nächstes Thema: CDONTSing from home computer vs antispam filters