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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. displaying latest 5 values from database table in datagrid

displaying latest 5 values from database table in datagrid

Scheduled Pinned Locked Moved ASP.NET
database
6 Posts 5 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.
  • M Offline
    M Offline
    mavii
    wrote on last edited by
    #1

    which SQL query will be used to display the last added 4 or values, i want the recent values to b displaed into datagrid as the database i updated daily

    E S M 3 Replies Last reply
    0
    • M mavii

      which SQL query will be used to display the last added 4 or values, i want the recent values to b displaed into datagrid as the database i updated daily

      E Offline
      E Offline
      Eduard Keilholz
      wrote on last edited by
      #2

      SELECT TOP # [fields] FROM [table] Replace # with the maximum number of records to return...

      .: I love it when a plan comes together :. http://www.zonderpunt.nl

      S 1 Reply Last reply
      0
      • M mavii

        which SQL query will be used to display the last added 4 or values, i want the recent values to b displaed into datagrid as the database i updated daily

        S Offline
        S Offline
        Sathesh Sakthivel
        wrote on last edited by
        #3

        Post your Question in the Suitable Forum.

        SSK.

        1 Reply Last reply
        0
        • E Eduard Keilholz

          SELECT TOP # [fields] FROM [table] Replace # with the maximum number of records to return...

          .: I love it when a plan comes together :. http://www.zonderpunt.nl

          S Offline
          S Offline
          Sonia Gupta
          wrote on last edited by
          #4

          sir, i think top # will give the first-n entries. but the question was the last 4 addded records.

          Sonia Gupta Soniagupta1@yahoo.co.in Yahoo messengerId-soniagupta1 Love is Friendship and Friendship is Love....

          E 1 Reply Last reply
          0
          • M mavii

            which SQL query will be used to display the last added 4 or values, i want the recent values to b displaed into datagrid as the database i updated daily

            M Offline
            M Offline
            Md Mustafa
            wrote on last edited by
            #5

            select top 5 * from table use above query .it will work...

            Mohammad Mustafa

            1 Reply Last reply
            0
            • S Sonia Gupta

              sir, i think top # will give the first-n entries. but the question was the last 4 addded records.

              Sonia Gupta Soniagupta1@yahoo.co.in Yahoo messengerId-soniagupta1 Love is Friendship and Friendship is Love....

              E Offline
              E Offline
              Eduard Keilholz
              wrote on last edited by
              #6

              Sir, I think you need to invert the order of your result set then... ORDER BY Fieldname DESC This will make sql sort the result set descending on field Fieldname and then pick the top 5 (which is then the latest 5)

              .: I love it when a plan comes together :. http://www.zonderpunt.nl

              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