I need to get the entire data of last row in datatable
For ex:
A. B
-
Type
-
Type
So i need to get the last row
Output should be
A. B
-
Type
I need to get the entire data of last row in datatable
For ex:
A. B
Type
Type
So i need to get the last row
Output should be
A. B
Type
Dt.Rows(dt.Rowcount-1)
will give you the last row of a datatable
You can add column names to access each column data of last row as Dt.Rows(dt.Rowcount-1)("Columnname").ToString
Cheers
Hi,
If you need the last row of datatable as DataRow type, the following will work.
dt.AsEnumerable.Last
If you need the last row of datatable as DataTable type, can you try the following?
{dt.AsEnumerable.Last}.CopyToDataTable
Regards,
How to remove the last row
Hi,
Can you try the following?
dt.AsEnumerable.Take(dt.Rows.Count-1).CopyToDataTable
Regards,
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.