Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Revisiting ASP 2

Status
Not open for further replies.

crackon

Programmer
Jun 17, 2009
26
I'm revisiting some ole ASP code and wondered what actual this does?

Set params = Request.QueryString
 
Hi,
If the page with this code were called by a URL like this:

Then that code would set the variable params to the passed string : Test='123'
- probably to use later in the page in a query to a database.



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
so if it was test=123&great=yes would that be params(1) = test=123 and params(2) = great=yes

?
 
Hi,
Great site for returnees ( or beginners) in asp to know about - star to guitarzan- I should have mentioned it myself ( and been more clear on my answer) [blush]:

In your original post the a URL like woul dbe handled in your page with a revised form of what you had:
Dim params
params = Request.QueryString("Test")..
Then the param variable would then be set to '123'

For your second example :

You would have 2 variables in the handleparams.asp page:

Dim param1,param2
param1 = Request.QueryString("Test")
param2 = Request.QueryString("great')

then
param1 = '123' and
param2 = 'yes'




[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
So its the result on each parameter not all of it?
 
Hi,
Yes - the QueryString is a method of passing named values to some other page for action...The page code then checks the name to get the value...
Here is an example that I have used to get information for a Crystal Reports application:

I pass a URL like this:

On the reportviewer page I have( in part):
Code:
'Get the values
Rid = Request.QueryString("ReportID")
NbrParams = Request.QueryString("NumParams")
If NbrParams > 0 then
ValStr   = Request.QueryString ("Pvals")
NameStr = Request.QueryString ("Pnames")
arrVals = Split(ValStr,";")
arrNames = Split(NameStr,",")
End If

This reads the QueryString and gets values for
How many parameters are in the string and
The values for the each one of those

I then create 2 arrays with the name and value lists to create what I need later to pass to the Crystal Report viewer object ( no need to detail that, this is just to show how a QueryString can be used).



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top