Querystring issue with the + sign separator

S

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
 
A

Anthony Jones

Simon Gare said:
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=205

Now the code is:-

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

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top