Retirn only a limited number of results.

Discussion in 'ASP .Net' started by Kenneth Keeley, Oct 28, 2004.

  1. Hi
    How can I limit the number of results returned from and SQL database to a
    datagrid. Ie I only want to return the latest ten news items for a news and
    events page.

    Thanks
    Kenneth
    Kenneth Keeley, Oct 28, 2004
    #1
    1. Advertising

  2. Kenneth Keeley

    naija naija Guest

    Hi Kenneth,
    I think SQL should be able to tackle that in your Query!
    Patrick




    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    naija naija, Oct 28, 2004
    #2
    1. Advertising

  3. Hi,
    You can do it this way
    select top 10 newsitems from newsTable order by date_time

    HTH
    srini
    "Kenneth Keeley" wrote:

    > Hi
    > How can I limit the number of results returned from and SQL database to a
    > datagrid. Ie I only want to return the latest ten news items for a news and
    > events page.
    >
    > Thanks
    > Kenneth
    >
    >
    >
    =?Utf-8?B?c3Jpbmk=?=, Oct 28, 2004
    #3
  4. Latest 10 should have DESC direction of ordering

    select top 10 newsitems from newsTable order by date_time desc

    assuming that "date_time" is of datetime type

    "srini" <> wrote in message
    news:...
    > Hi,
    > You can do it this way
    > select top 10 newsitems from newsTable order by date_time
    >
    > HTH
    > srini
    > "Kenneth Keeley" wrote:
    >
    > > Hi
    > > How can I limit the number of results returned from and SQL database

    to a
    > > datagrid. Ie I only want to return the latest ten news items for a news

    and
    > > events page.
    > >
    > > Thanks
    > > Kenneth
    > >
    > >
    > >
    Anton Sokolovsky, Oct 28, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Patrick
    Replies:
    1
    Views:
    366
    pete kirkham
    Aug 22, 2003
  2. Monique Y. Mudama
    Replies:
    1
    Views:
    444
    Monique Y. Mudama
    Jun 28, 2005
  3. Kris
    Replies:
    2
    Views:
    366
  4. mathieu
    Replies:
    11
    Views:
    468
    Victor Bazarov
    Dec 12, 2007
  5. Scott

    Number of WebMethods limited in .asmx file?

    Scott, Jul 26, 2004, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    188
    Scott
    Jul 26, 2004
Loading...

Share This Page