How to get the last row value from a datatable

how to get the last row value in datatable

1 Like

YourDataTable.AsEnumerable.Last() - will return last Datarow

lets assume a particular column value from the last row
YourDataTable.AsEnumerable.Last()(ColNameOrIndex)

2 Likes

how do i take this value in assign What should i take

1 Like

let us know on which option you are interested (last row, last row value) and when it is a column value retrieval which datatype do you expect (string, int32…)

1 Like

last row value

1 Like

lets assume string

Assign Activity:
YourVarName | DataType: String =
YourDataTable.AsEnumerable.Last()(ColNameOrIndex).ToString().Trim

1 Like

@T_Y_Raju You can use in datatable in assign activity refer below screenshot

Assign dt = dt.AsEnumerable.skip(dt.RowCount-1).Take(dt.RowCount).CopyToDataTable

image