Satish Bingi

Satish Bingi

  • 1.7k
  • 38
  • 1.8k

ArgumentNullException: Value cannot be null. (Parameter 's')

Mar 5 2024 1:59 PM

I am trying to pull data from the table which has a DateTime data type with NULL values.
I am trying to get the required data by using the below method. However, it's throwing an error : ArgumentNullException: Value cannot be null. (Parameter 's')

TermDate = s.TermDate.HasValue ? s.TermDate : DateTime.Parse(s.TermDate.ToString().Replace(null, "-"))
 

Property: public DateTime? TermDate { get; set; }

Please advise.


Answers (6)