isNothing(row(“GRN_DATE”) OrElse String.IsNullOrEmpty(row(“GRN_DATE”).toString.Trim)
and would replace with DBNull.Value
maybe you can quick test with a constructed dummy datarow
Kindly note:
DateTime.ParseExact(row(“GRN_DATE”).ToString,“MM/dd/yyyy”,System.Globalization.CultureInfo.InvariantCulture) is parsing the string with the configured format
ToString(…) is outputting the same format which is expected for the parsing.
When the parse format has to be the same as the reformated format then input is equal to output, so there is no change and it is unneeded
A powerfull technique is to work with TryParseExact and all non parseable date string can be set to DBNull.Value
in_dt_GrBlankAgeingDT.AsEnumerable.ToList.ForEach(Sub(row)
If(IsNothing(row(“GRN_DATE”)) Or (String.IsNullOrEmpty(row(“GRN_DATE”).tostring.Trim))) Then
row(“GRN_DATE”) = DBNull.Value
End If
End Sub
)
Thank you very much for the support, as always . Thanks to others also to pitch in.