Request .querystring problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi have have some link like thi
http://x.com/Shoppingcart.aspx?pn=p...04000=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
%
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>")
}
 
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
 
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
 
Back
Top