How to fetch first value in specific column

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(“Year”).ToString.Trim )



To fetch the first value of a particular column then check as below

Hope this may helps you


I don’t want to use loop

@Sharanabasava The option that has given @ksrinu070184 does not need a loop, you just have to assign it to a string


I didn’t use any loop you will get direct value from the DT as @Hiba_B said


If you want linq then you can make below changes in your code

varDT.AsEnumerable.Take(1).Select(function® r(“Year”))(0)

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.