Select function to remove rows in datatable that contain certain value

Hello, how can I use the select function on a datatable to remove rows that have a value of 0 or an empty string “” in a particular column?
Thank you

1 Like

Hi @Charmaine_Matsaudza

Use below query to get Nonempty and Nonzero row

dt.AsEnumerable().where(Function(x) not string.IsNullOrWhiteSpace(x(“columnName”).ToString) and not convert.ToInt32(x(“ColumnName”)).Equals(0)).CopyToDataTable

Thanks
Amaresan. P

1 Like

Thank you, this helped. But had to change the first condition to “IsEmpty”. Thank you :slight_smile:

1 Like

@Charmaine_Matsaudza, please mark reply as solution :slight_smile:

1 Like

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