I am new to .NET and am working on my first application.
Am using a dataset. A date field in the underlying SQL table allows nulls.
I have a web form that uses this field.
When the form encounters a record with a null value in this field I get the following message:
System.Data.StrongTypingException: Cannot get value because it is DBNull. --->
System.InvalidCastException: Cast from type 'DBNull' to type 'Date' is not valid. at...
It references the following code:
Public Property dtDateModified As Date
Catch e As InvalidCastException
Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
Me(Me.tableSBS_Property_Group.dtDateModifiedColumn) = value
I have read several posts here and elsewhere for handling nulls. Unfortunately, I haven't been smart enough to successfully implement any of them.
Your help is appreciated.