Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Limiting the Number of results retrived using ODBC on MS access DB by C# [modified]

Limiting the Number of results retrived using ODBC on MS access DB by C# [modified]

Scheduled Pinned Locked Moved Database
databasehelpcsharptutoriallounge
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cbh_
    wrote on last edited by
    #1

    Hi ;) im trying to Limit the number of results retrived by a Query so for Example i want to retrive the first 30 and then navigate throw the results 30 by 30. the problem in my Query that i cant used the TOP 30 command because im Ordering my results with date then status plus alot of ordering. and this ordering will cause the retrived results to be retrived in a random ID_no order as one of my friends suggested that i use the TOP 30 along with Where Id no > X Order BY Id_no as in the example below. but i think if there is no Command in MS Access or that i dont know it because of my lack of knowledge i will have to order by my Where Criteria along with the TOP 30 command. Another Sol. just popped to my head is to save the results to a Dataset and then using a Table in the Dataset i can just retrived Index based. i guess i will try the Dataset sollution also if there is any better one plz Help. By the way im using ODBC COnnection, OdbcCommand and ODBCDatareader. Thanks in Advance. Example for Retriving by the TOP and Where command: 1) Select TOP 30 A.ID_no , .......etc From A , ......etc Where A.ID_no > 1 Order by ID_no ; 2) Select TOP 30 A.ID_no , .......etc From A , ......etc Where A.ID_no > 30 Order by ID_no ; and i continue like that. ---------------------------------- Have fun and Stay good -- modified at 4:14 Saturday 25th November, 2006

    R 1 Reply Last reply
    0
    • C cbh_

      Hi ;) im trying to Limit the number of results retrived by a Query so for Example i want to retrive the first 30 and then navigate throw the results 30 by 30. the problem in my Query that i cant used the TOP 30 command because im Ordering my results with date then status plus alot of ordering. and this ordering will cause the retrived results to be retrived in a random ID_no order as one of my friends suggested that i use the TOP 30 along with Where Id no > X Order BY Id_no as in the example below. but i think if there is no Command in MS Access or that i dont know it because of my lack of knowledge i will have to order by my Where Criteria along with the TOP 30 command. Another Sol. just popped to my head is to save the results to a Dataset and then using a Table in the Dataset i can just retrived Index based. i guess i will try the Dataset sollution also if there is any better one plz Help. By the way im using ODBC COnnection, OdbcCommand and ODBCDatareader. Thanks in Advance. Example for Retriving by the TOP and Where command: 1) Select TOP 30 A.ID_no , .......etc From A , ......etc Where A.ID_no > 1 Order by ID_no ; 2) Select TOP 30 A.ID_no , .......etc From A , ......etc Where A.ID_no > 30 Order by ID_no ; and i continue like that. ---------------------------------- Have fun and Stay good -- modified at 4:14 Saturday 25th November, 2006

      R Offline
      R Offline
      Ritwik Sanyal
      wrote on last edited by
      #2

      Can you please clarify what is your criteria of retriving the TOP 30 records? Is it that, you want top 30 records as they appear in the table in the order of you primary key column? Is A>ID_no your primary key column? Can you please try the following and let me know: - SELECT A.ID_no , .......etc From A , ......etc Where 30>=(SELECT COUNT(*) FROM A a WHERE A.ID_no>=a.ID_no) Order by ID_no,........etc

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups