I am connecting to a database using VS2008 DataSets. One of the Tables within the database contains a DateTime Column that allows nulls (i.e. Type: DateTime?)
MSDN Datasets categorically states:
The Nullable or Nullable structure is not currently supported in the DataSet.
However on the MSDN site for TableAdapters states that TableAdaters CAN support Nullable Types:
The TableAdapters support nullable types Nullable(Of T) and T?. For more information on nullable types ... For more information on nullable types in C#, see Using Nullable Types (C# Programming Guide).
I'm confused!
In the DataSet Designer I have set the offending Column's property to 'AllowDBNull=True' but whenever I run a TableAdapter Query that returns a null DateTime (SELECT * FROM UDF) I get the following Exception: "ArguementOutOfRangeException: Year, Month, and Day parameters describe an un-representable DateTime."
One idea I had was to change the type of the Column to System.Object to correctly handle the null values and then I can do the conversions in my own code, however, I still get the same exception being raised.
This question suggests how to deal with the nulls once the query has returned, however I can't get the query to return.
How can I modify the TableAdapter and/or Dataset to allow me to run a query on the Table that can deal with the nulls in the database?