Check if a datatable contains rows with Null or Blanks in any Column/Cells

Hey everyone,

I want to check if a datatable contains any null or empty values,

DT.AsEnumerable.Any(Function(x)String.IsNullOrEmpty(x(“column name”).ToString)) i use this for making the same check on a column but I want to chec the whole datatable.

Any help? I dont want to copy paste the above code for all columns or use a for each loop since there are alot of columns and rows.



Give a try on

(From d in dtData.AsEnumerable
Let check = d.ItemArray.Any(Function (x) isNothing(x) OrElse String.IsNullOrEmpty(x.toString.trim))
Select check).Any(Function (e) e)

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