The typical way to check for whether anything has changed in the view when you’re navigating away from a page is to bind a method to the change event of each input and to set a flag if this has happened. This flag is then checked when leaving the page and a notification is shown to the user if the flag is raised. This is all good but it does not take into account things like changing the order of inputs and changing values back to their original values. Also, creating dynamic elements makes this way of doing things a bit tricky because you have to add registering of the handlers to each method which adds new elements.
Just recently I had to implement this kind of checkin Continue reading
BEGIN TRANSACTION — BEGIN TRANSACTION should come before or after BEGIN TRY that is not equally important, but it feels more right to have it inside the TRY-CATCH section.
— YOUR STATEMENTS COMES HERE
COMMIT — Don’t write this COMMIT after end of CATCH block because if you get an error and wind up in the CATCH up section, you will roll back the transaction. When you exit the CATCH block, you will
attempt to commit, but there is nothing to commit, so there will be a new error.
THROW — THROWING the original exception to the application. THROW statement is available in SQL server 2012. RAISEERROR() vs THROW: http://sqlhints.com/2013/06/30/differences-between-raiserror-and-throw-in-sql-server/
END CATCH Continue reading
A “SET” expression sets the specified local variable created previously to the given value. Continue reading
Why Static variables?
static variable shared the value of it among all instances of the class. Changes done to static variable are visible across methods. Static variable, that means it exists exactly one place in memory for the duration of the program. Static class variables are like globals. Static variables belong to type, not to its instance. You can change the value of a static variable in any of the method of that class. Continue reading
For example, If x is a local variable, will be effectively set to null anyway when the method is exited and the value of the return value is not null.
The finally statement is executed, but the return value isn’t affected. The execution order is:
- Code before return statement is executed
- Expression in return statement is evaluated
- finally block is executed
- Result evaluated in step 2 is returned