Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > request.querystring, all values if empty?

Reply
Thread Tools

request.querystring, all values if empty?

 
 
Kim
Guest
Posts: n/a
 
      05-23-2007
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.querystring("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.querystring("id") <> "") Then
rs_yadayada= request.querystring("id")
End If
%>

and in the sql: ...WHERE id = " + Replace(rs_yadayada__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.


 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      05-23-2007
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.querystring("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.querystring("id") <> "") Then
> rs_yadayada= request.querystring("id")
> End If
> %>
>
> and in the sql: ...WHERE id = " + Replace(rs_yadayada__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"


 
Reply With Quote
 
 
 
 
Kim
Guest
Posts: n/a
 
      05-23-2007
> 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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
![Oof Topix] All McCain, All Flip-Flop, All the Time Bucky Breeder Computer Support 7 09-27-2008 03:33 PM
XSL for All Values for All Nodes Al Hatch XML 3 06-05-2006 09:12 PM
not all values have corresponding parent values Jim in Arizona ASP .Net 4 08-23-2005 11:29 PM
Comparing values in 2 textfiles and returning the missing values Jorgen Gustafsson Perl 4 12-12-2003 09:09 AM
Re: Config values or Application values - which is better/faster? S. Justin Gengo ASP .Net 2 08-20-2003 04:08 PM



Advertisments