I've got a datatable with 5 columns, where a row is being filled with data then saved to the database via a transaction.
While saving, an error is returned:
The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value
new DataColumn("myDate", Type.GetType("System.DateTime"))
What kind of dates do you have in the column?
Do all of them fit within the range of the type?
As an aside, the correct way to get a
Type object for the
DataColumn constructor is the
typeof keyword, which is orders of magnitude faster.
Therefore, to create the column, you should write
new DataColumn("myDate", typeof(DateTime))