Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Request .querystring problem

Thread Tools

Request .querystring problem

Posts: n/a
Hi have have some link like thi
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
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]
Reply With Quote
Mark Fitzpatrick
Posts: n/a
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_" +
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi have have some link like this
> 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>");
> }

Reply With Quote
Posts: n/a
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

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Just got two emails: 1. your request for a new Access Code and 2. Request for my MCP ID# What's going on??!! belfast-biker Microsoft Certification 0 01-14-2006 12:49 PM
request.getRequestDispatcher(url).forward(request,response); problem Java 1 12-29-2004 05:13 AM
Problem in using Request and Request.Form norton ASP General 4 08-13-2004 03:02 PM
Re: Accessing Request.InputStream / Request.BinaryRead *as the request is occuring*: How??? Brian Birtle ASP .Net 2 10-16-2003 02:11 PM
System.Web.HttpException: Request timed out - [HttpException (0x80004005): Request timed out.] Steve ASP .Net 0 07-01-2003 12:11 AM