User2023521679 posted
I'm having a problem trying to come up with a way to come up with a function to either return a DateTime value or DBNull.Value.
In the following code exerpt, DData("HireDate")
is a DateTime field in a column of a DataRow. HireDate can either be a Date Value or an empty string. If I try DData("HireDate")
= IData("HireDate"),
this errors out when it is string.empty. I though the following code would work, but I get the error message Operator '=' is not defined for type 'DBNull' and string "".
DData("HireDate")
= IIf(IData("HireDate")
= "",
DBNull.Value,
IData("HireDate"))