473,794 Members | 2,752 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

getting response string problem

Hello,

I have declared in my program (*.aspx) something like this :

<%@ Page Language="VB" Debug="true" %>
....

<%
dim current_view_pa ge
current_view_pa ge = "1"

if not (Request.QueryS tring is nothing) then
current_view_pa ge = Request.QuerySt ring
end if

%>
in the body section I put something like this :

....
<% if current_view_pa ge = "1" then
response.write( " .... ")
end if
%>
I got an error message :

Operator is not valid for type 'HttpValueColle ction' and string "1".

Why ?

Thanks :)
Nov 18 '05 #1
4 1662
Mr. x wrote:
Operator is not valid for type 'HttpValueColle ction' and string "1".

Why ?


The QueryString object is a collection of name/value pairs, not an
actual string. Try something like this instead:

If current_view_pa ge.Item(<nameOf Param>) = "1" Then

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
Nov 18 '05 #2
Actually, the value of the name/value pair IS a string and should be
accessed as such:

<%
dim current_view_pa ge
current_view_pa ge = "1"

if Request.QuerySt ring <> "" then
current_view_pa ge = Request.QuerySt ring
end if
%>

By the way, you are using VB.NET now, not VB 6.0 and classic ASP so remember
to declare your variable types.

"Frank Oquendo" <fr*******@acad x.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Mr. x wrote:
Operator is not valid for type 'HttpValueColle ction' and string "1".

Why ?


The QueryString object is a collection of name/value pairs, not an
actual string. Try something like this instead:

If current_view_pa ge.Item(<nameOf Param>) = "1" Then

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)

Nov 18 '05 #3
Scott M. wrote:
Actually, the value of the name/value pair IS a string and should be
accessed as such:


That point was never argued. What I said is that a NameValueCollec tion
is not a string. In the code posted, the user is attempting to see if a
NameValueCollec tion object is equal to "1". That's an invalid comparison
as well as an invalid assignment.

I was surprised to see he got away wth the assignment in the first place
until you pointed out the lack of type declarations.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
Nov 18 '05 #4

"Frank Oquendo" <fr*******@acad x.com> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Scott M. wrote:
Actually, the value of the name/value pair IS a string and should be
accessed as such:
That point was never argued. What I said is that a NameValueCollec tion
is not a string. In the code posted, the user is attempting to see if a
NameValueCollec tion object is equal to "1". That's an invalid comparison
as well as an invalid assignment.


I see what you are saying, but to clarify: Request.QuerySt ring does return
a string. It may be several name/value pairs strung together and, yes,
QueryString is a collection, but when accessed via Request.QuerySt ring, you
get a string value back. Because he did not specify a specific name (or
index) to retrieve just means he'll get the whole string back and that is
his problem. As you pointed out, he's trying to evaluate the whole string
(names & values) against one particular value for one particular key in the
collection.

My main point was that he was using "Not Is Nothing" when he should have
been using <> "".

He is assigning the whole QueryString to "current_view_p age" and then later
checking "current_view_p age" for a value of "1", rather than either
assigning "current_view_p age" just the value of one of the keys in the
QueryString (which hopefully contains a value of "1") or when he's checking
the value of "current_view_p age", he should see if it contains "1" rather
than if it = "1".

Sorry for any confusion.

I was surprised to see he got away wth the assignment in the first place
until you pointed out the lack of type declarations.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)

Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3091
by: Hitesh | last post by:
Hi, I am getting the response from another Website by using the HttpHandler in my current site. I am getting the page but all the images on that page are not appearing only placeholder are displayed. Can anybody know this issue and help me to resolve this. In past i received the response saying that i should download the image first and then parse the actual response and modify the src attribute of the
1
1417
by: Nathan Sokalski | last post by:
I have retrieved data from a database using a SELECT statement that includes an INNER JOIN. The data seems to be retrieved to the DataSet OK, but I am having trouble getting the data from the DataSet. The code I am using is as follows: Private Sub btnDownloadDB_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnDownloadDB.Click Dim papdatabase As New DataSet Dim cmdSelect As New...
1
1874
imrosie
by: imrosie | last post by:
Please help with this one,,,,,I've been trying everything in my arsenal to fix this one. I'm stumped.... I"ve got a unbound combo box (customername) that has two events (on click); AfterUpdate and NotInList. The AfterUpdate uses a 'me.recordsetclone' in order to display other data in controls associated with customerid/customername from the Customer table. The NotInlist, does just that, adds a new customer name to the list along with...
0
2924
by: buntyindia | last post by:
Hi, I have a very strange problem with my application. I have developed it using Struts. I have a TextBox With Some fixed value in it and on Submit iam passing it to another page. <html:form action="/login"> <html:text property="userName" value="Bunty"/> <html:submit/>
1
4930
by: raghuvendra | last post by:
Hi I have a jsp page with 4 columns: namely Category name , Category order, Input field and a submit button. All these are aligned in a row. And Each Category Name has its corresponding Category order, Input field and a submit button. The Category name is being fetched from the oracle db along with the corresponding Category order. In the corresponding input field (text box) the user enters a new category order which gets stored in...
0
9671
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10433
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
10212
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...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6777
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
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4112
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
2
3720
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2919
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.