I am trying to import details from an access database into my sql application database. I have a check to make sure that it has imported all the rows, and if it hasn’t then I want it to stop the process and throw an error.
However, despite it going into the correct function, and hitting the “throw” line, it doesn’t throw the error, and instead just carries on with the process.
Should this code block not work?
AccessRepository details = new AccessRepository();
if (numRows != details.GetDetailsRowCount(periodsInFreq, payDate))
{
throw new DataException("Some data is missing from the Details table (only " + numRows.ToString() + " rows) - Please try again. If this problem persists, please contact the system administrator");
}
Thanks
Thanks to Varun and Zenwalker.
It turned out I had some nested catch statements which were cancelling each other out. I’ve since taken out the nested try/catches out and the errors now make a lot more sense.
Thanks