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.

Amit MohantyRank #112 · 20K reputationPosted Jul 19, 2022, 1:07 AM EDT
paul walker55 reputationPosted Jul 19, 2022, 9:11 AM EDT
Nitin SontakkeRank #264 · 9.6K reputationPosted Jul 18, 2022, 10:28 AM EDT
Satya KarkiRank #78 · 24.6K reputationPosted Jul 18, 2022, 11:10 PM EDT
paul walker55 reputationPosted Jul 19, 2022, 2:08 AM EDT
paul walker55 reputationPosted Jul 19, 2022, 3:06 AM EDT
Amit MohantyRank #112 · 20K reputationPosted Jul 19, 2022, 3:15 AM EDT
paul walker55 reputationPosted Jul 19, 2022, 3:45 AM EDT
Amit MohantyRank #112 · 20K reputationPosted Jul 19, 2022, 5:13 AM EDT