Some validation so that we do not receive unexpected sql errors
Trying to implement the validation, but somehow it doesn't want to do it. I just get the error message Ett oväntat fel inträffade vid uppdateringen av kontakten. But i shouldn't. Can't even debugg properly..
Found the error. Somehow Visual Studio didn't like to tell me that GetOrdinal didn't return correctly, since I had written @ContactID instead of just ContactID. Throwing exceptions that's is hard to find. Now it seems to be solved though.
The exception thrown from the SqlConnection is something that we want to handle separately, I think. So added that to the Update, not yet on the Delete though
Found a solution to a problem with the SqlConnection. If we can't reach the SqlServer the webpage will just stand around doing nothing for quite some time. So instead we use a function that checks the connection much faster. If it succeeds we know that it's quite safe to connect to the SqlServer. Of course it could go down after we did our check, but this way we don't have to wait 30 seconds all the time.
Custom exception on connection failure. This is a fatal exception, so you shouldn't check it really. But then again, we have a webform, so if we allow for fatal exceptions, that aren't truly fatal, then what will happen to the application. You can't recover from it as you'd expect, but it might be resolved later. I will have it there for a while atleast
The redirect works as it should now. So when you edit a person you don't end up on page 0 or something like that.
It's bad to have CausesValidation on the Cancel buttons, but it works now
Moved the ADO.NET stuff to a subfolder and added a DefaultError.htm page for those errors that aren't handeled by the code already
Messing around with the validator and such to comply with the spec. It's not fully done yet, but hopefully I have mastered the bvasics
Better ErrorMessages