473,387 Members | 1,890 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,387 software developers and data experts.

Request .querystring problem

Hi have have some link like thi
http://x.com/Shoppingcart.aspx?pn=ps...e&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
%
but in .Net when I try to use it it say it have error do you have any ide

foreach (string strPartNo in Request.QueryString["pn"])

int lngQty = Request.QueryString["qty_" + strPartNo]
Response.Write(strPartNo+Request.QueryString["pn"]+"<br>")
}
Nov 18 '05 #1
2 1819
Not knowing he error, it's a little hard to tell. Right off the bat though,
it could be because you can't just set a variable equal to the querystring.
When you reference Request.QueryString["qty_" + strPartNo], how will it know
what to do with the value. In VBScript, all the variables are of type
variant. This means they change their behavior depending upon their context.
In strongly typed languages, such as C#, you have to implicitely cast the
value. You can try to do it in two ways:

one way is:
int lngQty = (int)Request.QueryString["qty_" + strPartNo];
which attempts to implicitely cast it or:

int lngQty = Convert.ToInt32(Request.QueryString["qty_" +
strPartNo].ToString());
passes it through the convert function to change the string value into a
32-bit int.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

"mahsa" <an*******@discussions.microsoft.com> wrote in message
news:B5**********************************@microsof t.com...
Hi have have some link like this
http://x.com/Shoppingcart.aspx?pn=ps...&action=update now I want to request the data
I use this code in asp
<%For Each strPartNo In Request.QueryString("pn")
lngQty = Request.QueryString("qty_" & strPartNo)
strPartNo = LCase(strPartNo)
Response.Write("strPartNo"& strPartNo& lngQty)
Next
%>
but in .Net when I try to use it it say it have error do you have any idea
foreach (string strPartNo in Request.QueryString["pn"])
{
int lngQty = Request.QueryString["qty_" + strPartNo];
Response.Write(strPartNo+Request.QueryString["pn"]+"<br>");
}

Nov 18 '05 #2
hi tanck you actualy my problem is with this par
foreach (string strPartNo in Request.QueryString["pn"]
this part give error if i write foreach (string strPartNo in Request.QueryString) it works but i just want pn not all the values

Nov 18 '05 #3

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...
4
by: Guoqi Zheng | last post by:
On my application, I need to have different action based on the pass in query string. When the query string is not presented, I try to use If request.querystring("id") ="" THEN ...... This is...
2
by: Tim::.. | last post by:
Can someone please tell me how I do a request.querystring in ASP.NET??? I am trying to upgrade an ASP app to ASP.NET and improve it at the same time but I'm not sure how I use this querystring... ...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
7
by: SevDer | last post by:
Hi I have a class library that needs to download the HTML in a specific page of ours with provided querystring. When I open this URL with any browser, it loads fine. When I do WebRequest from Web...
4
by: Arvan | last post by:
there is 3 links to page default.aspx,and each one has a querystring,like a=1, b=1 ,c=1. problem is how do i ensure the name of querystring! how do?
5
by: =?Utf-8?B?QVRT?= | last post by:
PRB JavaScript in ASP with Request.Form Please help, I'm having a problem with JavaScript in ASP, where the ASP page crashes when I try to determine if data was posted from a FORM or through a...
7
by: =?Utf-8?B?QVRT?= | last post by:
HOWTO Make CStr for JavaScript on ASP w/ Request.Form and QueryString In ASP, Request.Form and Request.QueryString return objects that do not support "toString", or any JavaScript string...
2
by: Doogie | last post by:
Hi, I'm writing Javascript code to parse out a query string. I want to handle the case where a parameter value may not be sent. So consider a parameter called "State". If the user doesn't pass...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
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,...
0
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,...
0
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...

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.