Request .querystring problem

Discussion in 'ASP .Net' started by =?Utf-8?B?bWFoc2E=?=, May 13, 2004.

  1. 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>")
    }
     
    =?Utf-8?B?bWFoc2E=?=, May 13, 2004
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:...
    > Hi have have some link like this
    >

    http://x.com/Shoppingcart.aspx?pn=p...4000=1&sku=PS50210&cat=laminate&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>");
    > }
     
    Mark Fitzpatrick, May 13, 2004
    #2
    1. Advertising

  3. 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
     
    =?Utf-8?B?bWFoc2E=?=, May 13, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Daniel Bass
    Replies:
    2
    Views:
    3,777
    dave wanta
    Jul 4, 2003
  2. George
    Replies:
    5
    Views:
    6,679
    George
    Apr 2, 2004
  3. michaaal
    Replies:
    6
    Views:
    438
    Michael D. Kersey
    Jul 15, 2003
  4. John Davis
    Replies:
    2
    Views:
    426
    Dave Anderson
    Aug 18, 2003
  5. Ivan
    Replies:
    5
    Views:
    171
Loading...

Share This Page