Querystring issue with the + sign separator

Querystring issue with the + sign separator

am 23.10.2007 14:05:55 von Simon Gare

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

Re: Querystring issue with the + sign separator

am 23.10.2007 14:42:23 von Anthony Jones

"Simon Gare" wrote in message
news:%23sFGG0WFIHA.1168@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.


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"



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

&type=Single&userid=205

Now the code is:-

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


--
Anthony Jones - MVP ASP/ASP.NET

Re: Querystring issue with the + sign separator

am 23.10.2007 14:53:23 von Simon Gare

Anthony thanks for that will give it a go.

Regards
Simon

Re: Querystring issue with the + sign separator

am 23.10.2007 14:59:27 von McKirahan

"Simon Gare" wrote in message
news:#sFGG0WFIHA.1168@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