Hi Team,
I need to fetch first value from column using LINQ.
ie"Year" is equal to 2021
I have tried like this
dt1.AsEnumerable.Take(1).Select(Function(r) r(“Year”).ToString.Trim )
Hi Team,
I need to fetch first value from column using LINQ.
ie"Year" is equal to 2021
I have tried like this
dt1.AsEnumerable.Take(1).Select(Function(r) r(“Year”).ToString.Trim )
To fetch the first value of a particular column then check as below
dt.Rows(0).Item(“Year”).ToString
Hope this may helps you
Thanks
I don’t want to use loop
@Sharanabasava The option that has given @Srini84 does not need a loop, you just have to assign it to a string
If you want linq then you can make below changes in your code
varDT.AsEnumerable.Take(1).Select(function(r) r(“Year”))(0)
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.