In my Above table if the “condition” column is empty then dont select it
How do i do this in linq
Hey @Chirag12 ,
Use below linq
YourDT.Rows.Cast(Of DataRow)().Where(Function(row) Not (row("Condition") Is DBNull.Value Or Convert.Tostring(row("Condition")).Trim.Equals(""))).CopyToDataTable()
Hope it helps you
Please try this
Dt.AsEnumerable.Where(function(x) Not IsNothing(x("Condition")) AndAlso Not String.IsNullOrEmpty(x("Condition").ToString.Trim)).CopyToDataTable
Cheers
Hi @Chirag12
Try this
filteredRows = dt.AsEnumerable().Where(Function(row) Not String.IsNullOrWhiteSpace(row.Field(Of String)("condition"))).CopyToDataTable()
Hope it helps!!
Thank you @Vikas_M ,
It helped me
now i want to get only Used cars details with headers and store it into a new sheet
How do i do it
Hello @Chirag12,
I’m happy the solution worked for you. Could you please indicate the post as the solution and conclude this conversation thread? If you have more questions in the future, feel free to start a new topic.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.