473,738 Members | 7,599 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.QuerySt ring("pn"
lngQty = Request.QuerySt ring("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.QuerySt ring["pn"])

int lngQty = Request.QuerySt ring["qty_" + strPartNo]
Response.Write( strPartNo+Reque st.QueryString["pn"]+"<br>")
}
Nov 18 '05 #1
2 1841
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.QuerySt ring["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.Qu eryString["qty_" + strPartNo];
which attempts to implicitely cast it or:

int lngQty = Convert.ToInt32 (Request.QueryS tring["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*******@disc ussions.microso ft.com> wrote in message
news:B5******** *************** ***********@mic rosoft.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.QuerySt ring("pn")
lngQty = Request.QuerySt ring("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.QuerySt ring["pn"])
{
int lngQty = Request.QuerySt ring["qty_" + strPartNo];
Response.Write( strPartNo+Reque st.QueryString["pn"]+"<br>");
}

Nov 18 '05 #2
hi tanck you actualy my problem is with this par
foreach (string strPartNo in Request.QuerySt ring["pn"]
this part give error if i write foreach (string strPartNo in Request.QuerySt ring) 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
2737
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...
4
25361
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 what I did in trational asp, however if I did abov in ASP.NET, I always got an error of "Object reference not set to an instance of an object. " How should I solve the problem?
2
1506
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... EG: I have a content management system I want a user to be able to view only his documents according to the logon... This I think I can work out The problem is when a user clicks on a document I want it to open in the editor. In ASP I did...
6
3811
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 is more that 1249 bytes, then the progress bar of the browser will move too slow and then displaying that the page not found!!!! If the message is less than or equal to 1249 then no problem.
7
2534
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 Project it is again fine. However whenever I do this request from this class library, it fails. I put every kind of user permission to the actual folder, and through inetmgr. Right now everyone has full control. But still I got the problem.
4
2868
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
5905
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 QueryString. Where, if the data came through via a FORM, I want to use it 1st, but if not, to then try using it from the QueryString. Basically, the problem boils down to using "toString()" on Request.Form("NAME") and Request.QueryString("NAME")...
7
9661
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 operation on parameters not passed. Example: Make a TST.asp and post to it as TST.asp?STATE=TEST <%@ Language=JavaScript %> <%
2
5520
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 that in if I do this: var state = <%=Request.QueryString%> This returns an undefined object that I can't seem to do any checks
0
8788
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9476
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
9335
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...
0
8210
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
6053
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4570
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
4825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3279
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
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.