473,804 Members | 2,109 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

request.queryst ring, all values if empty?

Kim
How do I get all walues if my querystring is empty?
If I have a table with let's say 10 rows/records, (ID 1-10). I then have a
recordset with request.queryst ring("id") and get the record having the id
thats shown in the address bar ("..com?id=4 " would get the record with the
id 4). How do I get all records if the querystring is empty ("..com")

I have:

<%
Dim rs_yadayada
rs_yadayada= "1"
If (request.querys tring("id") <"") Then
rs_yadayada= request.queryst ring("id")
End If
%>

and in the sql: ...WHERE id = " + Replace(rs_yada yada__id, "'", "''")
-but doesn't get me anything if the querystring is empty. Tried changing the
"1" to wildcards, arrays (1-10),.. but nope, I'm too dumb to figure this
out.
May 23 '07 #1
2 7399
Kim wrote:
How do I get all walues if my querystring is empty?
If I have a table with let's say 10 rows/records, (ID 1-10). I then
have a recordset with request.queryst ring("id") and get the record
having the id thats shown in the address bar ("..com?id=4 " would get
the record with the id 4). How do I get all records if the
querystring is empty ("..com")
I have:

<%
Dim rs_yadayada
rs_yadayada= "1"
If (request.querys tring("id") <"") Then
rs_yadayada= request.queryst ring("id")
End If
%>

and in the sql: ...WHERE id = " + Replace(rs_yada yada__id, "'", "''")
-but doesn't get me anything if the querystring is empty. Tried
changing the "1" to wildcards, arrays (1-10),.. but nope, I'm too
dumb to figure this out.
If you want to retrieve all the records in a table, what sql statement would
you write? Write it down. Got it? Now, in your code, check to see if the
quertystring variable is empty. If it is empty, use the sql statement you
just wrote down instead of building one with a where clause.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
May 23 '07 #2
Kim
If you want to retrieve all the records in a table, what sql statement
would you write? Write it down. Got it? Now, in your code, check to see if
the quertystring variable is empty. If it is empty, use the sql statement
you just wrote down instead of building one with a where clause.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Thanks, got it.
May 23 '07 #3

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

Similar topics

4
2743
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
13237
by: Steve | last post by:
Hi- I'd like to set values in the QueryString if I detect that a user submits a bad value, say... ?id=333 where there is no id '333', I would like to set it to '0' for example. I tried to use Request.QueryString.Set("id", "0"); it says it is Read Only. How can this be done? Why is there a Set() method if you can't use it?
4
25366
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?
5
10994
by: VB Programmer | last post by:
I have an ASPX page that is used for content. I have a master page which sticks the page in an IFrame. Question: From the content/ASPX page, I can't seem to reference request.querystring. Any way around this? I need to read it. Thanks!
1
3478
by: C | last post by:
Hi, I have been using VB.Net for the past 2 years and have moved to C# I send a value in the URL to a page. In my called page I do below. int intTest = int.Parse(Request.QueryString);
6
1431
by: Roshawn Dawson | last post by:
Hi, While browsing the web, I've noticed that a lot of websites have values in the url without any file extensions mentioned. Consider this (fake) url: http://www.yourdomain.com/article/1 It seems that the "1" is actually a querystring value. I always thought that you must first specify a file with a valid extension and then append the querystring value, like this:
4
2869
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?
2
5523
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
945
by: mcaneaney | last post by:
I have created an array ‘GiftOnDeath(n)’, where n = the number of gifts… Dim GiftOnDeath() ‘do some code and collect the number of gifts ‘NumGiftsOnDeath' Redim GiftOnDeath(NumGiftsOnDeath) <%for i = 1 to NumGiftsOnDeath%> <tr><td >Gift <%response.write(i)%> </td> <td >
0
10604
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
10354
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
9177
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...
1
7643
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
6870
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
5536
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
5675
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4314
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
3005
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.