473,382 Members | 1,261 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Request.QueryString looping....easy question...

I need to do the following...

FOR myitem IN Request.Querystring
'get the key
'get the value
NEXT

What do I DIM myitem as? DictionaryEntry doesn't work...or do I have to
loop through it by index and get the key then the item out of the query
string...

thanks
Doug

Nov 18 '05 #1
9 6016
Lenn,
Tried that and I checked the type and it came back as string....basicly
just the key names that are part of my querystring....

Doug
"Lenn" <Le**@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.com...
Dim something as Object
"Doug" wrote:
I need to do the following...

FOR myitem IN Request.Querystring
'get the key
'get the value
NEXT

What do I DIM myitem as? DictionaryEntry doesn't work...or do I have to
loop through it by index and get the key then the item out of the query
string...

thanks
Doug

Nov 18 '05 #2
Doug,
System.Collections.Specialized.NameValueCollection
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Doug" <sw******@hotmail.com> wrote in message
news:OC**************@TK2MSFTNGP09.phx.gbl...
I need to do the following...

FOR myitem IN Request.Querystring
'get the key
'get the value
NEXT

What do I DIM myitem as? DictionaryEntry doesn't work...or do I have to
loop through it by index and get the key then the item out of the query
string...

thanks
Doug

Nov 18 '05 #3
Thanks Justin...but this still requires me to give an index or a name to the
collection object....

dim myitem as NameValueCollection
dim sKey as string
Dim sValue as string
for each myitem in Request.QueryString
'here item needs an index/name...
sKey = myitem.item(some index or name)
next

I thought there was a way to iterate through the querystring collection
without having a counter....using for each then
sKey = myitem.key
sValue = myitem.value
etc...

thanks
Doug
"S. Justin Gengo" <sjgengo@aboutfortunate[no-spam].com> wrote in message
news:10*************@corp.supernews.com...
Doug,
System.Collections.Specialized.NameValueCollection
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Doug" <sw******@hotmail.com> wrote in message
news:OC**************@TK2MSFTNGP09.phx.gbl...
I need to do the following...

FOR myitem IN Request.Querystring
'get the key
'get the value
NEXT

What do I DIM myitem as? DictionaryEntry doesn't work...or do I have to
loop through it by index and get the key then the item out of the query
string...

thanks
Doug


Nov 18 '05 #4
Doug,

No, then you can loop through the keys...

Dim Value As String

For Each Item As System.Collections.Specialized.NameValueCollection In
Request.QueryString

For Each Key As String In Item.AllKeys

Value = Item.Get(Key)

Next

Next
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Doug" <sw******@hotmail.com> wrote in message
news:e%***************@TK2MSFTNGP12.phx.gbl...
Thanks Justin...but this still requires me to give an index or a name to the collection object....

dim myitem as NameValueCollection
dim sKey as string
Dim sValue as string
for each myitem in Request.QueryString
'here item needs an index/name...
sKey = myitem.item(some index or name)
next

I thought there was a way to iterate through the querystring collection
without having a counter....using for each then
sKey = myitem.key
sValue = myitem.value
etc...

thanks
Doug
"S. Justin Gengo" <sjgengo@aboutfortunate[no-spam].com> wrote in message
news:10*************@corp.supernews.com...
Doug,
System.Collections.Specialized.NameValueCollection
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Doug" <sw******@hotmail.com> wrote in message
news:OC**************@TK2MSFTNGP09.phx.gbl...
I need to do the following...

FOR myitem IN Request.Querystring
'get the key
'get the value
NEXT

What do I DIM myitem as? DictionaryEntry doesn't work...or do I have to loop through it by index and get the key then the item out of the query string...

thanks
Doug



Nov 18 '05 #5
Doug,

Don't know what I was thinking when I typed out that code. (The code works
fine) I should have used the variable name "Collection" instead of "Item".

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Doug" <sw******@hotmail.com> wrote in message
news:e%***************@TK2MSFTNGP12.phx.gbl...
Thanks Justin...but this still requires me to give an index or a name to the collection object....

dim myitem as NameValueCollection
dim sKey as string
Dim sValue as string
for each myitem in Request.QueryString
'here item needs an index/name...
sKey = myitem.item(some index or name)
next

I thought there was a way to iterate through the querystring collection
without having a counter....using for each then
sKey = myitem.key
sValue = myitem.value
etc...

thanks
Doug
"S. Justin Gengo" <sjgengo@aboutfortunate[no-spam].com> wrote in message
news:10*************@corp.supernews.com...
Doug,
System.Collections.Specialized.NameValueCollection
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Doug" <sw******@hotmail.com> wrote in message
news:OC**************@TK2MSFTNGP09.phx.gbl...
I need to do the following...

FOR myitem IN Request.Querystring
'get the key
'get the value
NEXT

What do I DIM myitem as? DictionaryEntry doesn't work...or do I have to loop through it by index and get the key then the item out of the query string...

thanks
Doug



Nov 18 '05 #6
And Geez, now that I test the code out why not just cut right to the chase
and simplify like this:

Dim Value As String

For Each Item As String In Request.QueryString.AllKeys

Value = Item.Get(Key)

Next

Sorry, it took me so long to get to the correct code for you.
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Doug" <sw******@hotmail.com> wrote in message
news:e%***************@TK2MSFTNGP12.phx.gbl...
Thanks Justin...but this still requires me to give an index or a name to the collection object....

dim myitem as NameValueCollection
dim sKey as string
Dim sValue as string
for each myitem in Request.QueryString
'here item needs an index/name...
sKey = myitem.item(some index or name)
next

I thought there was a way to iterate through the querystring collection
without having a counter....using for each then
sKey = myitem.key
sValue = myitem.value
etc...

thanks
Doug
"S. Justin Gengo" <sjgengo@aboutfortunate[no-spam].com> wrote in message
news:10*************@corp.supernews.com...
Doug,
System.Collections.Specialized.NameValueCollection
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Doug" <sw******@hotmail.com> wrote in message
news:OC**************@TK2MSFTNGP09.phx.gbl...
I need to do the following...

FOR myitem IN Request.Querystring
'get the key
'get the value
NEXT

What do I DIM myitem as? DictionaryEntry doesn't work...or do I have to loop through it by index and get the key then the item out of the query string...

thanks
Doug



Nov 18 '05 #7
Doug,

Man, I need some rest. See what staying up till 2:00am drinking mountain dew
and coding can do to you!

The code with the two for nexts was the right way.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Doug" <sw******@hotmail.com> wrote in message
news:e%***************@TK2MSFTNGP12.phx.gbl...
Thanks Justin...but this still requires me to give an index or a name to the collection object....

dim myitem as NameValueCollection
dim sKey as string
Dim sValue as string
for each myitem in Request.QueryString
'here item needs an index/name...
sKey = myitem.item(some index or name)
next

I thought there was a way to iterate through the querystring collection
without having a counter....using for each then
sKey = myitem.key
sValue = myitem.value
etc...

thanks
Doug
"S. Justin Gengo" <sjgengo@aboutfortunate[no-spam].com> wrote in message
news:10*************@corp.supernews.com...
Doug,
System.Collections.Specialized.NameValueCollection
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Doug" <sw******@hotmail.com> wrote in message
news:OC**************@TK2MSFTNGP09.phx.gbl...
I need to do the following...

FOR myitem IN Request.Querystring
'get the key
'get the value
NEXT

What do I DIM myitem as? DictionaryEntry doesn't work...or do I have to loop through it by index and get the key then the item out of the query string...

thanks
Doug



Nov 18 '05 #8
Doug,

I've splashed some cold water on my face and going for a record number of
posts by one person on the same topic here is the code you need:
Dim Value As String

For Each Key As String In Request.QueryString.AllKeys

Value = Request.QueryString(Key)

Next


--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Doug" <sw******@hotmail.com> wrote in message
news:e%***************@TK2MSFTNGP12.phx.gbl...
Thanks Justin...but this still requires me to give an index or a name to the collection object....

dim myitem as NameValueCollection
dim sKey as string
Dim sValue as string
for each myitem in Request.QueryString
'here item needs an index/name...
sKey = myitem.item(some index or name)
next

I thought there was a way to iterate through the querystring collection
without having a counter....using for each then
sKey = myitem.key
sValue = myitem.value
etc...

thanks
Doug
"S. Justin Gengo" <sjgengo@aboutfortunate[no-spam].com> wrote in message
news:10*************@corp.supernews.com...
Doug,
System.Collections.Specialized.NameValueCollection
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Doug" <sw******@hotmail.com> wrote in message
news:OC**************@TK2MSFTNGP09.phx.gbl...
I need to do the following...

FOR myitem IN Request.Querystring
'get the key
'get the value
NEXT

What do I DIM myitem as? DictionaryEntry doesn't work...or do I have to loop through it by index and get the key then the item out of the query string...

thanks
Doug



Nov 18 '05 #9
Thanks Justin....I'm feeling the same...too much work not enough
sleep...thanks for the replys...

Doug

"S. Justin Gengo" <sjgengo@aboutfortunate[no-spam].com> wrote in message
news:10*************@corp.supernews.com...
Doug,

Man, I need some rest. See what staying up till 2:00am drinking mountain dew and coding can do to you!

The code with the two for nexts was the right way.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Doug" <sw******@hotmail.com> wrote in message
news:e%***************@TK2MSFTNGP12.phx.gbl...
Thanks Justin...but this still requires me to give an index or a name to the
collection object....

dim myitem as NameValueCollection
dim sKey as string
Dim sValue as string
for each myitem in Request.QueryString
'here item needs an index/name...
sKey = myitem.item(some index or name)
next

I thought there was a way to iterate through the querystring collection
without having a counter....using for each then
sKey = myitem.key
sValue = myitem.value
etc...

thanks
Doug
"S. Justin Gengo" <sjgengo@aboutfortunate[no-spam].com> wrote in message
news:10*************@corp.supernews.com...
Doug,
System.Collections.Specialized.NameValueCollection
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Doug" <sw******@hotmail.com> wrote in message
news:OC**************@TK2MSFTNGP09.phx.gbl...
> I need to do the following...
>
> FOR myitem IN Request.Querystring
> 'get the key
> 'get the value
> NEXT
>
> What do I DIM myitem as? DictionaryEntry doesn't work...or do I
have to > loop through it by index and get the key then the item out of the query > string...
>
> thanks
> Doug
>
>
>



Nov 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Max | last post by:
Hello. This is the first time I've posted to a newsgroup, and I do this because I'm in desperate need of help. I'm working a user management system, and when I activate a user that has registered...
5
by: Ivan | last post by:
hi, I saw some program using "request("fieldname") " instead of "request.QueryString" to get the value from URL, what's the different ?? thanks
1
by: andrewdreib | last post by:
I am still very new to ASP and am trying to create an ASP page that gets records from a database. Right not I can successfully get one field of information at a time and randomize it, but I need...
2
by: mahsa | last post by:
Hi have have some link like thi http://x.com/Shoppingcart.aspx?pn=ps50210&qty_ps50210=1&pn=excel&qty_excel=1&pn=l4504000&qty_l4504000=1&sku=PS50210&cat=laminate&action=updat now I want to request...
1
by: EoRaptor013 | last post by:
Not sure where to ask this question, but... I'm using a TreeView component to enable browsing file folders in a specific directory (for test purposes /Program Files/). Some users use an ampersand...
1
by: agantony | last post by:
Hi All, I am new to programming so apologies if this is a basic question. I am using the following code to request the form field values. however all works as expected but the field order is...
4
by: =?Utf-8?B?UGF1bA==?= | last post by:
This may be a stupid question but... How do I programmtically access the page's request.querystring value in a custom user control. I tried doing this in the page_load routine of the user...
12
by: Peter | last post by:
Hi if I have a url/query like "localhost?a&b&c=123" then I thought I could get these parameters and values by using NameValueCollection query = HttpContext.Current.Request.QueryString; But if...
4
by: .nLL | last post by:
Hi, im am a classic asp developer and started to learn asp.net but got stuck with a simple problem even before i step in to further. to learn i have started from a simple project (a login system...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.