473,834 Members | 1,910 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Request.QuerySt ring looping....easy question...

I need to do the following...

FOR myitem IN Request.Queryst ring
'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 6034
Lenn,
Tried that and I checked the type and it came back as string....basic ly
just the key names that are part of my querystring....

Doug
"Lenn" <Le**@discussio ns.microsoft.co m> wrote in message
news:7F******** *************** ***********@mic rosoft.com...
Dim something as Object
"Doug" wrote:
I need to do the following...

FOR myitem IN Request.Queryst ring
'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.Collecti ons.Specialized .NameValueColle ction
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

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

FOR myitem IN Request.Queryst ring
'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 NameValueCollec tion
dim sKey as string
Dim sValue as string
for each myitem in Request.QuerySt ring
'here item needs an index/name...
sKey = myitem.item(som e index or name)
next

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

thanks
Doug
"S. Justin Gengo" <sjgengo@aboutf ortunate[no-spam].com> wrote in message
news:10******** *****@corp.supe rnews.com...
Doug,
System.Collecti ons.Specialized .NameValueColle ction
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

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

FOR myitem IN Request.Queryst ring
'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.Collecti ons.Specialized .NameValueColle ction In
Request.QuerySt ring

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******@hotma il.com> wrote in message
news:e%******** *******@TK2MSFT NGP12.phx.gbl.. .
Thanks Justin...but this still requires me to give an index or a name to the collection object....

dim myitem as NameValueCollec tion
dim sKey as string
Dim sValue as string
for each myitem in Request.QuerySt ring
'here item needs an index/name...
sKey = myitem.item(som e index or name)
next

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

thanks
Doug
"S. Justin Gengo" <sjgengo@aboutf ortunate[no-spam].com> wrote in message
news:10******** *****@corp.supe rnews.com...
Doug,
System.Collecti ons.Specialized .NameValueColle ction
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

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

FOR myitem IN Request.Queryst ring
'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******@hotma il.com> wrote in message
news:e%******** *******@TK2MSFT NGP12.phx.gbl.. .
Thanks Justin...but this still requires me to give an index or a name to the collection object....

dim myitem as NameValueCollec tion
dim sKey as string
Dim sValue as string
for each myitem in Request.QuerySt ring
'here item needs an index/name...
sKey = myitem.item(som e index or name)
next

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

thanks
Doug
"S. Justin Gengo" <sjgengo@aboutf ortunate[no-spam].com> wrote in message
news:10******** *****@corp.supe rnews.com...
Doug,
System.Collecti ons.Specialized .NameValueColle ction
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

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

FOR myitem IN Request.Queryst ring
'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.QuerySt ring.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******@hotma il.com> wrote in message
news:e%******** *******@TK2MSFT NGP12.phx.gbl.. .
Thanks Justin...but this still requires me to give an index or a name to the collection object....

dim myitem as NameValueCollec tion
dim sKey as string
Dim sValue as string
for each myitem in Request.QuerySt ring
'here item needs an index/name...
sKey = myitem.item(som e index or name)
next

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

thanks
Doug
"S. Justin Gengo" <sjgengo@aboutf ortunate[no-spam].com> wrote in message
news:10******** *****@corp.supe rnews.com...
Doug,
System.Collecti ons.Specialized .NameValueColle ction
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

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

FOR myitem IN Request.Queryst ring
'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******@hotma il.com> wrote in message
news:e%******** *******@TK2MSFT NGP12.phx.gbl.. .
Thanks Justin...but this still requires me to give an index or a name to the collection object....

dim myitem as NameValueCollec tion
dim sKey as string
Dim sValue as string
for each myitem in Request.QuerySt ring
'here item needs an index/name...
sKey = myitem.item(som e index or name)
next

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

thanks
Doug
"S. Justin Gengo" <sjgengo@aboutf ortunate[no-spam].com> wrote in message
news:10******** *****@corp.supe rnews.com...
Doug,
System.Collecti ons.Specialized .NameValueColle ction
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

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

FOR myitem IN Request.Queryst ring
'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.QuerySt ring.AllKeys

Value = Request.QuerySt ring(Key)

Next


--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

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

dim myitem as NameValueCollec tion
dim sKey as string
Dim sValue as string
for each myitem in Request.QuerySt ring
'here item needs an index/name...
sKey = myitem.item(som e index or name)
next

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

thanks
Doug
"S. Justin Gengo" <sjgengo@aboutf ortunate[no-spam].com> wrote in message
news:10******** *****@corp.supe rnews.com...
Doug,
System.Collecti ons.Specialized .NameValueColle ction
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

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

FOR myitem IN Request.Queryst ring
'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@aboutf ortunate[no-spam].com> wrote in message
news:10******** *****@corp.supe rnews.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******@hotma il.com> wrote in message
news:e%******** *******@TK2MSFT NGP12.phx.gbl.. .
Thanks Justin...but this still requires me to give an index or a name to the
collection object....

dim myitem as NameValueCollec tion
dim sKey as string
Dim sValue as string
for each myitem in Request.QuerySt ring
'here item needs an index/name...
sKey = myitem.item(som e index or name)
next

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

thanks
Doug
"S. Justin Gengo" <sjgengo@aboutf ortunate[no-spam].com> wrote in message
news:10******** *****@corp.supe rnews.com...
Doug,
System.Collecti ons.Specialized .NameValueColle ction
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Doug" <sw******@hotma il.com> wrote in message
news:OC******** ******@TK2MSFTN GP09.phx.gbl...
> I need to do the following...
>
> FOR myitem IN Request.Queryst ring
> '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
2747
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 to my system, the current admin user logged in gets logged out. I can't seem to work out how - I can't even trace back where some of the variables are coming from (for example, the "ref" part of the Request.QueryString method). Could someone...
5
2427
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
3315
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 the whole string. I've been searching the internet trying to find an answer to this question and I found these two commands Request.querystring and Recordset.GetString, but I don't think I know how to use them properly. Here's the code I have...
2
1844
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 the dat I use this code in as <%For Each strPartNo In Request.QueryString("pn" lngQty = Request.QueryString("qty_" & strPartNo strPartNo = LCase(strPartNo Response.Write("strPartNo"& strPartNo& lngQty Next %
1
2941
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 ("&") in both folder and file names. This has caused me some real grief! I'm not in a position to tell the users it's an ID 10 T error and they have to change their file and folder names. In VS2K5, I have debugged my code and found that ...
1
1675
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 mixed up. I have tried setting the tabindex on the fields,to try and resolve the issue, but no such luck. Is there any way i can sort the field order using the tabindex ? Thanks in advance.
4
3717
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 control but I do not seem to be able to access the value? TIA.
12
14887
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 I then try "query.AllKeys" I only get two keys, namely "null" and "c". Is this correct behaviour? Are "a" and "b" considered to be values for
4
1865
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 with forms) due to projects platform (a mobile web site) i cant use cookies (cookies arent supported on all phones), anyway because of that i do un/pw check on very page and i have to put Dim MyUn As String =...
0
9800
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10800
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10516
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10556
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10225
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9339
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5629
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5800
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4429
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.