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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looping through Form and QueryString Collections

Status
Not open for further replies.

FesterSXS

Programmer
Feb 4, 2002
2,196
GB
Is it possible to do the following? If so can someone tell me the correct syntax...
Code:
For Each item in Request.Form AND Request.QueryString

Next
I'm trying to loop through both collections together. The code in the loop constructs a SQL query. The existing code just loops through the FORM collection and I would like to modify it so it includes the QueryString collection as well.

I could do this with 2 separate loops but it means doing a lot of work rewriting the code in the loop.

Tony
________________________________________________________________________________
 
just using the request collection should do it
Code:
for each item in request

...

next

one point is that this will go through the whole request collection, including cookies and servervariables.



Chris.

Indifference will be the downfall of mankind, but who cares?
A website that proves the cobblers kids adage.
Nightclub counting systems

So long, and thanks for all the fish.
 
I tried that alread. I got the following error:

Object doesn't support this property or method

Tony
________________________________________________________________________________
 
You are going to have to have 2 seperate loops, there is no alternative. eve if you could (which you can't), how would you handle the probable situations where the Form and QueryString contained different amounts of items.

Dim sFormKey,sFormValue,sQueryKey,sQueryValue
For Each formItem in Request.Form
sFormKey = formItem
sFormvalue = Request.Form(sFormKey)
Next

For Each formItem in Request.QueryString
sQueryKey= formItem
sQueryvalue= Request.Form(sQueryKey)
Next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top