Recently, I was working on a project when I came into a problem that I hadn’t dealt with before. You see I was working with a rather large table (200+ fields) and a corresponding archive table for it. The goal was to be able to populate a form with fields from either of the object types as essentially they were the same record type.
With the implementation of MVC there is a lot more room for unhanded global exceptions because in MVC you are encouraged to write more in line code to accompany the back end code. So what happens when an exception is thrown within the front end code? Well you’ll have an exception that will bubble up to the global application class which if you don’t handle it there it will continue to bubble and be displayed to the user as specified in the web configuration file. This doesn’t do you much good, sure the user will know that there is an error, and you can squelch the amount of information that is displayed to your ordinary users, but if working through trouble shooting the issue this basic information does you no good.
There are a number of different reasons that you would want to get your database results in a random order. I’ve had a number of different reasons to do this so far throughout my career, the first of which was in a simple T-SQL statement that we were pulling up a list of items that we wanted in a random order. Turns out that with T-SQL there is a really simple way to get your results in a random order. All you have to do is add the following to the end of your SQL statement.