Question

I am getting this error when I retrieve a row with a null DataTime field:

'srRow.Closed_Date' threw an exception of type 'System.Data.StrongTypingException'

How do I properly handle these?

Was it helpful?

Solution

You can check for a null value in that column before retrieving the value.

if (!srRow.IsClosed_DateNull())
{
  myDate = srRow.Closed_Date;
}

OTHER TIPS

There's a reference here.

or possibly, can you modify your query to ensure the results are not null by using the IsNull operator?

Select (IsNull, SomeDateField, GetDate())

Assuming you're using .NET, there are SqlTypes that can be used in a situation like this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top