Transaction Isolation Levels 

This demo shows how writing and reading in transactions are affected by the setting of the respective isolation levels. You will have to import the file into a Windows .NET application and set frmOptimist as the Startup page.

The solution uses the Northwind SQL Server database. You will have to reset the connection strings of the two SqlConnection objects in the Property window.

You start either transaction with the respective Lock button and you commit it with the Commit and Release buttons, respectively. Prior to starting the transaction you will have to select the isolation level you require for that transaction.

You could e.g. test the following

1.    Do a Lock-Read-Release sentence in the Read section to check what the present value in the DB is (Last Name of the first employee)

2.    Select ReadCommitted in the Write section and ReadUncommitted in the Read section.
       Click Lock in the Write section, change the value , and click Change, but do not commit.
       Click Lock, Read and Release in the Read section to see that you can see the uncommitted value.
       Commit in the Wtite section.

3.    Repeat step 2 but with the Read section set to ReadCommitted.
       You will now read the original value.

4.    Set the Read isolation to RepeatableRead.
       Lock and read in the Read section.
       Lock and try to change and commit in the Write section. This will not be allowed.

 

 

 

 

 


frmIsolationLevel.vb