G
Guest
Hi,
I am trying to assign NULL to a datetime field in the SQL Server database.
Here is the code that does NOT work:
INSERT INTO ...
....
VALUES ...
....
CType(IIf(dateWitness2Date.Checked, dateWitness2Date.Value, DBNull.Value), DateTime), & ...
It says "Cast from DBNull to Data is not valid"
If I relpace DBNull.Value with Nothing, then it seem to work but assigns MinDate instead of Null to the value.
Can you please give me some advise how to do this? Thank you.
I am trying to assign NULL to a datetime field in the SQL Server database.
Here is the code that does NOT work:
INSERT INTO ...
....
VALUES ...
....
CType(IIf(dateWitness2Date.Checked, dateWitness2Date.Value, DBNull.Value), DateTime), & ...
It says "Cast from DBNull to Data is not valid"
If I relpace DBNull.Value with Nothing, then it seem to work but assigns MinDate instead of Null to the value.
Can you please give me some advise how to do this? Thank you.