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. General Programming
  3. C#
  4. Dataset

Dataset

Scheduled Pinned Locked Moved C#
databasehelptutorialquestion
5 Posts 3 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.
  • S Offline
    S Offline
    skrishnasarma
    wrote on last edited by
    #1

    Hi I have some records say 1000 Nos fetched from SQL and stored in a Dataset. Now I need to fetch and store top 1-50 records in another dataset and top 51-100 records in another dtaset and so on. Could any one help me how to transfer records from one Dataset to another dataset? Regards San

    C 1 Reply Last reply
    0
    • S skrishnasarma

      Hi I have some records say 1000 Nos fetched from SQL and stored in a Dataset. Now I need to fetch and store top 1-50 records in another dataset and top 51-100 records in another dtaset and so on. Could any one help me how to transfer records from one Dataset to another dataset? Regards San

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Surely what you want is a stored procedure that pages your data ? The way to do this is to do two selects, that are nested, use the TOP statement in both, and have one ordered ASC and the other DESC. So the first grabs from the first record through to the last one you want, the other inverts the order and selects from the last one you want to the first one you want. Christian Graus - Microsoft MVP - C++

      S 1 Reply Last reply
      0
      • C Christian Graus

        Surely what you want is a stored procedure that pages your data ? The way to do this is to do two selects, that are nested, use the TOP statement in both, and have one ordered ASC and the other DESC. So the first grabs from the first record through to the last one you want, the other inverts the order and selects from the last one you want to the first one you want. Christian Graus - Microsoft MVP - C++

        S Offline
        S Offline
        skrishnasarma
        wrote on last edited by
        #3

        Sorry My idea is to manipulate the data locally, . My ultimate aim is to do paging in dataGrid since winform GataGrid is not supporting the Paging.

        C L 2 Replies Last reply
        0
        • S skrishnasarma

          Sorry My idea is to manipulate the data locally, . My ultimate aim is to do paging in dataGrid since winform GataGrid is not supporting the Paging.

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Really ? Only the web DataGrid does paging ? I didn't realise that. Well, the easiest thing would still be a stored proc that takes a page number and size, but if you want to limit your database access, then I guess you'd store the full table locally, and build a datasource from it that you bind to the grid, selecting only the current page rows. Christian Graus - Microsoft MVP - C++

          1 Reply Last reply
          0
          • S skrishnasarma

            Sorry My idea is to manipulate the data locally, . My ultimate aim is to do paging in dataGrid since winform GataGrid is not supporting the Paging.

            L Offline
            L Offline
            Luis Alonso Ramos
            wrote on last edited by
            #5

            I would add a DataColumn with AutoIncrement set to true to the table, and then use a DataView and its RowFilter property to just return the records with that column from 1 to 50. -- LuisR


            Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!

            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