Linq query to check datatable date column is empty or not validation

Using below query in IF condition to check date column is empty or not and getting error “If: Cannot perform ‘<>’ operation on System.DateTime and System.String.”

dt_DDH_Records.select("DateColumn <> ‘’ " ).Length>0

1 Like

can you check following

dt_DDH_Records.AsEnumerable.Any(Function (x) IsNothing(x("DateColumn")) OrElse String.IsNullOrEmpty(x("DateColumn").toString.Trim)))

it will return true if there is 1 or more rows where the datecolumn is null or empty

1 Like

Its working for both condition when there is value it return true but when no value also it return true it should return false

can we refer to your data and your implementation?

1 Like

its working bro i have refered wrong column

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