Re: [wdvltalk] Limited Records - ASP

2008-06-06 Thread David Precious
On 06/05/2008 11:36 PM, Todd Richards wrote:
 Hey Everyone -
 
 I'm having a brain lapse here and can't figure out the right way to do
 this.  On a home page, I have Upcoming Events with a box floating to the
 right  that will show the next 5 events.  I was trying to use rs.pagesize =
 5 but for some reason it's not working (although it is in another site).
 So instead, I simply added a 
 
% if page_count =5 then %  (page_count is defined higher up and is
 incremented during the while statement)
 
   Code to show the event
 
   % end if %
 
 This seems to work, but it's probably not very efficient.  Any thoughts?

Where are these events coming from?

If they're coming from a database, you'd be a lot better off just
telling the database you only want 5 records (by adding LIMIT 5 to the
query) rather than retrieving a full set, displaying the first 5 and
throwing the rest away!


 • The WDVL Discussion List from WDVL.COM • 
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
   Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

  http://www.wdvl.com  ___

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.


RE: [wdvltalk] Limited Records - ASP

2008-06-06 Thread Todd Richards
Yes, it's coming from a MS SQL Server 2000 DB, and I'm using ASP to pull the
data.  Does that offer the limit, or is that just a MySQL feature?

Todd
  

-Original Message-
From: David Precious [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 06, 2008 3:52 AM
To: wdvltalk@lists.wdvl.com
Subject: Re: [wdvltalk] Limited Records - ASP

On 06/05/2008 11:36 PM, Todd Richards wrote:
 Hey Everyone -
 
 I'm having a brain lapse here and can't figure out the right way to do
 this.  On a home page, I have Upcoming Events with a box floating to the
 right  that will show the next 5 events.  I was trying to use rs.pagesize
=
 5 but for some reason it's not working (although it is in another site).
 So instead, I simply added a 
 
% if page_count =5 then %  (page_count is defined higher up and
is
 incremented during the while statement)
 
   Code to show the event
 
   % end if %
 
 This seems to work, but it's probably not very efficient.  Any thoughts?

Where are these events coming from?

If they're coming from a database, you'd be a lot better off just
telling the database you only want 5 records (by adding LIMIT 5 to the
query) rather than retrieving a full set, displaying the first 5 and
throwing the rest away!


 . The WDVL Discussion List from WDVL.COM . 
To Join wdvltalk, Send An Email To:
mailto:[EMAIL PROTECTED] or
use the web interface
http://e-newsletters.internet.com/discussionlists.html/
   Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

  http://www.wdvl.com  ___

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.


 • The WDVL Discussion List from WDVL.COM • 
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
   Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

  http://www.wdvl.com  ___

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.


Re: [wdvltalk] Limited Records - ASP

2008-06-06 Thread David Precious
On 06/06/2008 04:54 PM, Todd Richards wrote:
 Yes, it's coming from a MS SQL Server 2000 DB, and I'm using ASP to pull the
 data.  Does that offer the limit, or is that just a MySQL feature?

Anything that does SQL should be able to handle the LIMIT clause - even
MS SQL Server.  Just stick it on the end of your query and job done :)


 • The WDVL Discussion List from WDVL.COM • 
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
   Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

  http://www.wdvl.com  ___

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.


RE: [wdvltalk] Limited Records - ASP

2008-06-06 Thread Todd Richards
Hmm, it's throwing an error on me about a missing operator.  I've got my
statement as 

SQL = SELECT * FROM table ORDER BY StartDate LIMIT 5

Does that look right?  

I also tried using Top, and that doesn't produce the right results
(select top 5 * from table...)

Todd


-Original Message-
From: David Precious [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 06, 2008 11:04 AM
To: wdvltalk@lists.wdvl.com
Subject: Re: [wdvltalk] Limited Records - ASP

On 06/06/2008 04:54 PM, Todd Richards wrote:
 Yes, it's coming from a MS SQL Server 2000 DB, and I'm using ASP to pull
the
 data.  Does that offer the limit, or is that just a MySQL feature?

Anything that does SQL should be able to handle the LIMIT clause - even
MS SQL Server.  Just stick it on the end of your query and job done :)


 . The WDVL Discussion List from WDVL.COM . 
To Join wdvltalk, Send An Email To:
mailto:[EMAIL PROTECTED] or
use the web interface
http://e-newsletters.internet.com/discussionlists.html/
   Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

  http://www.wdvl.com  ___

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.


 • The WDVL Discussion List from WDVL.COM • 
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
   Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

  http://www.wdvl.com  ___

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.


Re: [wdvltalk] Limited Records - ASP

2008-06-06 Thread David Precious
On 06/06/2008 05:15 PM, Todd Richards wrote:
 Hmm, it's throwing an error on me about a missing operator.  I've got my
 statement as 
 
 SQL = SELECT * FROM table ORDER BY StartDate LIMIT 5
 
 Does that look right?  


It looks right to me, but a quick Google suggests that MS SQL doesn't
support LIMIT after all.  Yuck.

I'd thought it was a standard part of SQL, but Googling suggests that it
isn't.


 I also tried using Top, and that doesn't produce the right results
 (select top 5 * from table...)

My quick Google suggests that that would be the correct answer.

What goes wrong with it?

I don't know anything about MS SQL I'm afraid (and I'd like to keep it
that way), so I can't be of very much help to you - maybe someone else
on here can?

 • The WDVL Discussion List from WDVL.COM • 
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
   Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

  http://www.wdvl.com  ___

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.


Re: [wdvltalk] Limited Records - ASP

2008-06-06 Thread r937

Anything that does SQL should be able to handle the LIMIT clause - even
MS SQL Server.  Just stick it on the end of your query and job done :)


in a word, no

;o)

 • The WDVL Discussion List from WDVL.COM • 
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
  Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

  http://www.wdvl.com  ___

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.


Re: [wdvltalk] Limited Records - ASP

2008-06-06 Thread r937

I also tried using Top, and that doesn't produce the right results
(select top 5 * from table...)


this is, indeed, what you use for SQL Server

do you have an ORDER BY clause?


rudy
http://r937.com/

 • The WDVL Discussion List from WDVL.COM • 
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
  Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

  http://www.wdvl.com  ___

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.


RE: [wdvltalk] Limited Records - ASP

2008-06-06 Thread Todd Richards
Yeah, I do have an ORDER BY.  Maybe I don't have it in the right place?

Todd


-Original Message-
From: r937 [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 06, 2008 12:50 PM
To: wdvltalk@lists.wdvl.com
Subject: Re: [wdvltalk] Limited Records - ASP

 I also tried using Top, and that doesn't produce the right results
 (select top 5 * from table...)

this is, indeed, what you use for SQL Server

do you have an ORDER BY clause?


rudy
http://r937.com/


 • The WDVL Discussion List from WDVL.COM • 
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
   Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

  http://www.wdvl.com  ___

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.


Re: [wdvltalk] Limited Records - ASP

2008-06-06 Thread r937

Yeah, I do have an ORDER BY.  Maybe I don't have it in the right place?


if it isn't at the end, you'd get a syntax error

could you perhaps show us the entire query?  or did i miss it already?


rudy

 • The WDVL Discussion List from WDVL.COM • 
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
  Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

  http://www.wdvl.com  ___

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.


Re: [wdvltalk] Limited Records - ASP

2008-06-06 Thread r937

Here is the original - SELECT * FROM events ORDER BY StartDate

Without anything, I will get 10 events listed on the page.  If I try
SELECT TOP 5 * FROM events ORDER BY StartDate,
then I only get the first 2 events.


quite frankly, i just do not believe that

try running it in Query Analyzer or whatever your front-end-tool-du-jour

many times, what people think is an SQL problem turns out to be a problem in
their app logic dealing with a perfectly good SQL result set

;o)

besides, you want

  SELECT TOP 5 ... ORDER BY StartDate DESC

because you want the latest 5


 • The WDVL Discussion List from WDVL.COM • 
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
  Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

  http://www.wdvl.com  ___

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.


RE: [wdvltalk] Limited Records - ASP

2008-06-06 Thread Todd Richards
No, you didn't miss it!  :)

Here is the original - SELECT * FROM events ORDER BY StartDate

Without anything, I will get 10 events listed on the page.  If I try SELECT
TOP 5 * FROM events ORDER BY StartDate, then I only get the first 2 events.

If I put it at the end like this SELECT * FROM events ORDER BY StartDate
TOP 5, then I get an error message:

Syntax error (missing operator) in query expression 'StartDate TOP
5'.

Todd


-Original Message-
From: r937 [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 06, 2008 4:09 PM
To: wdvltalk@lists.wdvl.com
Subject: Re: [wdvltalk] Limited Records - ASP

 Yeah, I do have an ORDER BY.  Maybe I don't have it in the right place?

if it isn't at the end, you'd get a syntax error

could you perhaps show us the entire query?  or did i miss it already?


rudy

 . The WDVL Discussion List from WDVL.COM . 
To Join wdvltalk, Send An Email To:
mailto:[EMAIL PROTECTED] or
use the web interface
http://e-newsletters.internet.com/discussionlists.html/
   Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

  http://www.wdvl.com  ___

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.


 • The WDVL Discussion List from WDVL.COM • 
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
   Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

  http://www.wdvl.com  ___

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.


RE: [wdvltalk] Limited Records - ASP

2008-06-06 Thread Todd Richards
Ugh - After I started looking at this I realized that it's an Access DB -
not SQL Server (which I'm used to working with).  I'm guessing that might be
the difference?

Todd


-Original Message-
From: r937 [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 06, 2008 5:02 PM
To: wdvltalk@lists.wdvl.com
Subject: Re: [wdvltalk] Limited Records - ASP

 Here is the original - SELECT * FROM events ORDER BY StartDate

 Without anything, I will get 10 events listed on the page.  If I try
 SELECT TOP 5 * FROM events ORDER BY StartDate,
 then I only get the first 2 events.

quite frankly, i just do not believe that

try running it in Query Analyzer or whatever your front-end-tool-du-jour

many times, what people think is an SQL problem turns out to be a problem in
their app logic dealing with a perfectly good SQL result set

;o)

besides, you want

   SELECT TOP 5 ... ORDER BY StartDate DESC

because you want the latest 5


 . The WDVL Discussion List from WDVL.COM . 
To Join wdvltalk, Send An Email To:
mailto:[EMAIL PROTECTED] or
use the web interface
http://e-newsletters.internet.com/discussionlists.html/
   Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

  http://www.wdvl.com  ___

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.


 • The WDVL Discussion List from WDVL.COM • 
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
   Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

  http://www.wdvl.com  ___

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.


Re: [wdvltalk] Limited Records - ASP

2008-06-06 Thread r937

Ugh - After I started looking at this I realized that it's an Access DB -
not SQL Server (which I'm used to working with).  I'm guessing that might 
be

the difference?


in general, you cannot use the same SQL in different database systems

in particular, you can almost never use the same SQL in one microsoft 
product (Access) as another microsoft product (SQL Server)


however, in this case, bofadem* support TOP, so you're okay

;o)



* i just cannot pass up an opportuinity to use one of my favourite words, 
bofadem






 • The WDVL Discussion List from WDVL.COM • 
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
  Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

  http://www.wdvl.com  ___

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.


Re: [wdvltalk] Limited Records - ASP

2008-06-06 Thread joseph harris

From: r937

bofadem*


;o)



* i just cannot pass up an opportuinity to use one of my 
favourite words, bofadem





Perfect, a trademark looking for a product:

Bofadem, the cleaner with bleach
The law partners are at your service, Bofadem.

Joseph 



 • The WDVL Discussion List from WDVL.COM • 
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
  Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

  http://www.wdvl.com  ___

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.


[wdvltalk] Limited Records - ASP

2008-06-05 Thread Todd Richards
Hey Everyone -

I'm having a brain lapse here and can't figure out the right way to do
this.  On a home page, I have Upcoming Events with a box floating to the
right  that will show the next 5 events.  I was trying to use rs.pagesize =
5 but for some reason it's not working (although it is in another site).
So instead, I simply added a 

   % if page_count =5 then %  (page_count is defined higher up and is
incremented during the while statement)

Code to show the event

% end if %

This seems to work, but it's probably not very efficient.  Any thoughts?

Todd


 • The WDVL Discussion List from WDVL.COM • 
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
   Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

  http://www.wdvl.com  ___

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.