I am trying to validate a date field from a sql server DB, and Ii is raising error - "Conversion from string "" to type 'Date' is not valid" or
Conversion from DBNull to type 'Date' is not valid". Validation is for loading a datagridview with datatable thru a BindingSource.
Here is my date field validation code
IIf(bsRow.Item("TermDate") IsNot DBNull.Value AndAlso Not (Trim(bsRow.Item("TermDate").ToString) = ""), CDate(bsRow.Item("Cobra Termination Date").ToString("MM/dd/yyyy"), "NULL")
I have tried different validation ie. string.isemptyornull(), isnothing(), bsRow.Item("Termination Date").ToString = "NULL"
Any help will be greatly appreciated.
Conversion from DBNull to type 'Date' is not valid". Validation is for loading a datagridview with datatable thru a BindingSource.
Here is my date field validation code
IIf(bsRow.Item("TermDate") IsNot DBNull.Value AndAlso Not (Trim(bsRow.Item("TermDate").ToString) = ""), CDate(bsRow.Item("Cobra Termination Date").ToString("MM/dd/yyyy"), "NULL")
I have tried different validation ie. string.isemptyornull(), isnothing(), bsRow.Item("Termination Date").ToString = "NULL"
Any help will be greatly appreciated.