Afternoon...
I have a small app that loads data from an excel worksheet to a sql server database table via a data table.
I have a column in the spreadsheet that contains a date.
I set the column in the data table thus...
dt.Columns.Add("EffectiveDateOfTransaction_CR0057", typeof(DateTime));
and on processing each row of the spreadsheet into the data table thus...
MyNewRow["EffectiveDateOfTransaction_CR0057"] = (DateTime)(worksheet.Cells[i, 25] as Excel.Range).Value;
I get an exception as DateTime cannot be null.
I have checked the web, but I am pretty new to this, there seems to be something DateTime?, but I cant seem to make it work.
Any help appreciated.