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. LINQ
  4. how to get last row value in the datable

how to get last row value in the datable

Scheduled Pinned Locked Moved LINQ
csharpdatabasehelptutoriallearning
5 Posts 4 Posters 29 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
    Member_14495935
    wrote on last edited by
    #1

    Hai Friends,I am a beginner to Csharp.So please help me.My Query is :I have created datatable in datagridview and inserted columns and rows in that table.how to get last row value in a data table. please clarify in simple way.

    L H 2 Replies Last reply
    0
    • M Member_14495935

      Hai Friends,I am a beginner to Csharp.So please help me.My Query is :I have created datatable in datagridview and inserted columns and rows in that table.how to get last row value in a data table. please clarify in simple way.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Could not be much simpler than using DataTable.Rows Property (System.Data) | Microsoft Docs[^].

      M 1 Reply Last reply
      0
      • L Lost User

        Could not be much simpler than using DataTable.Rows Property (System.Data) | Microsoft Docs[^].

        M Offline
        M Offline
        Mycroft Holmes
        wrote on last edited by
        #3

        You send the poor sod off to MS doco for "please clarify in a simple way" :laugh: :laugh: :laugh:

        Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP

        L 1 Reply Last reply
        0
        • M Mycroft Holmes

          You send the poor sod off to MS doco for "please clarify in a simple way" :laugh: :laugh: :laugh:

          Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Had he looked at the documentation in the first place he would have a) (probably) found the answer, and b) maybe actually learned how to solve simple problems.

          1 Reply Last reply
          0
          • M Member_14495935

            Hai Friends,I am a beginner to Csharp.So please help me.My Query is :I have created datatable in datagridview and inserted columns and rows in that table.how to get last row value in a data table. please clarify in simple way.

            H Offline
            H Offline
            Hailu Worku Obsse
            wrote on last edited by
            #5

            Try the following approach: public Product GetLastProduct(DataContext dt) { return dt.Products.Last(); } this code assumes two things: 1. your database has a Product table 2. You have created LINQ to SQL and you have dragged and Dropped the Product table on to the DataContext named dt

            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