Private m_ExpirationDate As Nullable(Of DateTime)
Public Property ExpirationDate() As Nullable(Of DateTime)
Get
Return m_ExpirationDate
End Get
Set(ByVal value As Nullable(Of DateTime))
m_ExpirationDate = value
End Set
End Property
Dim rec As New DBML.Staff With _
{.StaffDesc = m_StaffDesc, _
.LastName = m_LastName, _
.FirstName = m_FirstName, _
.MiddleInit = m_MiddleInit, _
.Gender = m_Gender, _
.Certification = m_Certification, _
.ExpirationDate = m_ExpirationDate, _ ********
.Active = m_Active, _
.CEPDNo = m_CEPDNo, _
.FaNo = m_FaNo, _
.PIC = m_PIC, _
.PICValid = m_PICValid, _
.PICCheckDate = Today(), _
.PICError = m_PICError}
_db.Staffs.InsertOnSubmit(rec)
Try
_db.SubmitChanges()
RetVal = rec.StaffID.ToString
Catch exp As Exception
RetVal = "Insert Failed:" & exp.Message
End Try
When I run the insertonsubmit it will fail bacause the value of the m_ExpirationDate is null, though it shows 12:00:00:00AM. So how can I test this value and if it is null don't include it in the "InsertOnSubmit" statement. I don't want to pass a phoney value like 1/1/1900.
Any help is appreciated.