c# - Reading an Excel file with empty fields -
To read and excel the file, I am using Window Service written in C #. Some fields may be empty in Excel Sheet. I get an error message, when reading Excel sheet at the point where the column is empty I column is a datetime field.
"SqlDateTime overflow should be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM."
This is my code;
if (! DBNull.Value.Equals (dRow [3]) {n.RBank_operator_date = DateTime.Parse (dRow [3] .tostring () trimand ('' ')); }
I believe you just need to do this.
if (dRow [3]! = Null) {n.RBank_operator_date = DateTime.Parse (dRow [3] .restring (.) TrimEnd ('' ')); }
DB-BUL is used while working with the database.
Comments
Post a Comment