Re: Consolidated Exceptions
you can loop on all the records once you uploaded the file and log them into string builder, if you find any problems print the string builder with the list of all the error and let the user fix them and then re-upload the file or fix the file online.
Re: Consolidated Exceptions
Exception handling is technically for error's you can't test for in code. A try catch block as you have it will work but will not give great details (row, column etc of excel) that caused the error. It will give something like "dataType mismatch converting string to integer" or something which is difficult for the user to know which entry caused the error when reviewing the log.
If there is never going to be a review of the error log to fix the data then it doesn't matter. If the data needs correcting then I'd test each field for each row to ensure it conforms to your spec's if not log that and the row data then you have everything needed to call up the data and highlight problems.
Re: Consolidated Exceptions
Hello,
To be clear, in order to work on the excel file, your website will have to have completely uploaded the excel file onto the server, before it can work on it. So the upload process won't be cancelled. But rather, the processing of the file. Is that correct?
Depending on how you write you code, I would suggest that you try to use the built in .TryParse methods, such as Double.TryParse, DateTime.TryParse etc. That way, for each row, you can try and get the information out of the row, as you expect it, if you can't, then you can log an error, and handle it, but then continue the rest of the processing.
I think it would help if you show us a section of the code that you are trying to use, and then we can work from there.
Gary