I think I found the solution. I have to use the SqlDateTime class in the System.Data.SqlTypes namespace:
DateTime exitDateTime;
if (drvPortfolio["ExitDateTime"] != DBNull.Value)
exitDateTime = (DateTime)drvPortfolio["ExitDateTime"];
else
exitDateTime = (DateTime)SqlDateTime.Null;
>I've been talking to Bonnie on this one, because I didn't have an answer beyond a workaround. We were curious what the variable was being used for, since you mentioned you're using some type of grid. However, if you're using a datetime picker, then that might affect what you do, since a datetime picker can't use a null date.
>
>At any rate, the only workaround I can think of is to come up with a 'fake date' in the past, one that would never normally be assigned.
>
>You can use this fake date as a comparison in subsequent lines of code, like whether to display something, whether to assign a stored procedure parameter, etc.
>
>If either bonnie or myself comes up with something better, we'll post something, but for now, using a fake date is all we can really think of.
>
>Kevin
Chris McCandless
Red Sky Software