.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

Isolation level in ADO.net

Posted By:      Posted Date: September 16, 2010    Points: 0   Category :ASP.Net
I am trying to apply transaction during updating in my Financial table "F_Ledger". I want that when Transaction A is updating the record in this table Transaction B should be able to read the records but could not update it till Transaction A is committed. For this i wrote following code:         Public Sub BeginTransaction()            oTransaction = oSQLConnection.BeginTransaction(IsolationLevel.RepeatableRead)        End Sub  here  oTransactionis an instance of "SqlTransaction" class and "oSQLConnection" is an instance of "SqlConnection" objectAfter this i called the BeginTransaction and did not let the transaction to commit by applying breakpoint.Now when i try to execute "select * from F_Ledger"  in SQL server Query analyser it hangs...which implies that since first transaction ("suppose A") has not completed (i.e Committed)  therefore "select * from F_Ledger" ("suppose B") is not executing. I tried with all the isolation levels but this happens in all cases. So i am wondering why "select * from F_Ledger", which is a read operation not working with RepeatableRead isolation type, whick locks the resource in shared mode. Same is also

View Complete Post

More Related Resource Links

What is the default isolation level (SQL Server 2008)

Hi, My database settings are: SET ALLOW_SNAPSHOT_ISOLATION ON READ_COMMITTED_SNAPSHOT ON Does this mean I don't have to explicitly have: Set Transaction Isolation Level Read Committed for each proc, i.e. because I have the two settings at the database level there is no need set the Transaction Isolation Level in each proc or does this need to be done as well as the database level settings. Cheer, Peter  

multiple executions of MERGE statement: Help with suitable TRANSACTION ISOLATION LEVEL

Folks, I am reasonably new to SQL Server. I am using SQL Server 2008 (no SP) on Windows XP. I am using the MERGE statement within a TSQL procedure to update a master/detail table pair (Master/Child), in which the MERGE inserts into the MASTER if a record based on the primary key doesn't exist and does, effectively nothing, if it does (well, it does an UPDATE set PK=PK so the record is passed on to the OUTPUT statement for insertion into the CHILD). Regardless as to the situation, the CHILD record has a record created when the MASTER exists or doesn't exist. Now, this code works fine with the standard TRANSACTION LEVELS. But I don't know what to do when I am running two instances of the same MERGE statement at the same time. One execution could create a record in the MASTER which the other process might try and create 5 minutes later. I really don't know what SET TRANSACTION ISOLATION LEVEL to use to allow both processes to run at the same time. I have looked at: ALTER DATABASE $(usedbname) SET READ_COMMITTED_SNAPSHOT ON; ALTER DATABASE $(usedbname) SET ALLOW_SNAPSHOT_ISOLATION ON; But these don't seem to work with their associated TSQL calls. I know this is a complex issue, but as a new SQL Server user, I didn't know where else to go. regards Simon                              

How to capture isolation level changes in Profiler


I'm looking for a way to catch when application code changes the isolation level for a connection.

When code such as this is run: 

tran = con.BeginTransaction(IsolationLevel.Serializable);

sys.dm_exec_sessions shows the change in isolation level from immediately before to immediately after the statement, but Profiler only shows the transaction starting, not the change of isolation level.  

TM: Begin Tran starting
TM: Begin Tran completed

Any subsequent Audit Login event in Profiler will report that the isolation level has changed, but this is due to the bug (by design) with the connection pool not resetting the isolation level when the connection is recycled.

The environment is SQL 2008 sp1.



Isolation Level set to Read Committed Snapshot, Deadlock Graph shows Read Committed


I must misunderstand something here. I have altered the DB to allow READ_COMMITTED_SNAPSHOT and some deadlock situations have been solved. Nevertheless, in a very similar situation, I'm getting deadlocks and the deadlock graph (XML) shows me the following:

isolationlevel="read committed (2)"

What do I miss here?



Isolation Level Read Uncommitted , Nolock & Replication



    Scenario : 

1. We have replication for Database D1.T1, D1.T2 , D1.T3
        Also have replication for Database D2.T1, D2.T2, D1.T3
2. We have view setup like
   Create View V1
   Select * from D1.T1
   Union All
   Select * from D2.T1

   Similarly V2 & V3
3.  We have Procedure using view V1, V2, V3

Fact. Set ISOLATION LEVEL READ UNCOMMITTED is always use inside the procedure

Question :

    1.  Procedure using Views V1 without NOLOCK on it (but have ISOLATION LEVEL UNCOMMITTED) , will that impact the replication on table T1, T2, T3  or Performance of the procedure or any Blocking?

   2. Procedure using Views V1 with Nolock on it (also have Isolation level Uncommitted) , Will that impact the replication on table T1, T2, T3 or performance of the procedure or any blocking?

3. Procedure using Views V1 with Nolock on it (Also have isolation level uncommitted) and
(Change my view as
  Create View V1
   Select * from D1.T1 With (nolock)
   Union All
   Select * from D2.T1 with (nolock)<

Can I configure the default isolation level for all my SSRS reports.


By default connections to SQL Server are made Read Committed. However in a lot of situation this can result on locking of other users when a big SSRS report is executing. Is there a way to configure my SSRS server that it will connect by default with isolation level Read Uncommited to the database.

At this moment you need to specify the transaction isolation level in every dataset of the report. This will result in problems of somebody forget to specify. By configuring this on server or connection level, you know for sure that all reports are executing with Read Uncommitted.

More information about this topic canbe found on my blog: http://www.keepitsimpleandfast.com/2010/11/bad-performance-and-lockings-occur-ad.html



Isolation Level


dbcc useroptions gives me what isolation level is set on the system. How do i find if it is pessimistic or optimistic?

In which situations do we change the server wide isolation levels? eg in OLTP vs Reporting vs DSS

What have you observed in your environments?

A Low Level Look at ASP.NET Architecture

ASP.NET is a powerful platform for building Web applications, that provides a tremendous amount of flexibility and power for building just about any kind of Web application. Most people are familiar only with the high level frameworks like WebForms and WebServices which sit at the very top level of the ASP.NET hierarchy. In this article I'll describe the lower level aspects of ASP.NET and explain how requests move from Web Server to the ASP.NET runtime and then through the ASP.NET HTTP pipeline to process requests.

Need help using control adapters at the machine level

Hi guys!

Let me explain our situation. I do web development at a university at which we have to meet strict accessibility guidelines. I've specially modified the adapters (as well as extended CompositeDataBoundControlAdapter to include GridView) for use on our site and to use with our global stylesheets as well as compiled the control adapters into a DLL.

The control adapters now all reside in the WebServices.CssFriendlyAdapters DLL.  (For example, WebServices.CssFriendlyAdapters.GridViewAdapter).

Currently, when someone drops an App_Browsers folder in to their site with the adapters specified, the adapters work. However, we'd like to be able to specify this in the C:\WINDOWS\Microsoft.NET\Framework\(version number)\CONFIG\Browsers directory so that the adapters work automatically without anyone having to move anything into App_Browsers for every site. To ensure that someone can still use the "old way" or will not be confused by their controls being adapted, I've written in code that uses the base rendering methods unless xhtmlConformance is set to "Strict" in the site's web.config file.

Anyway, on to the problem. When trying to compile the controlAdapters into the C:\WINDOWS\Microsoft.NET\Framework\(version number)\CONFIG\Browsers directory using aspnet_regbrowsers.exe (see http://msdn2.microsoft.com/en-us/library/ms229858.a

Wicked Code: Taking Silverlight Deep Zoom To The Next Level


With the help of Silverlight Deep Zoom and a remarkable control named MultiScaleImage, you can create scenes with many levels of zoom. Jeff Prosise illustrates with what else but the Mandlebrot set.

Jeff Prosise

MSDN Magazine July 2009

.NET Profiling: Write Profilers With Ease Using High-Level Wrapper Classes


Here Joachim H. Fröhlich and Reinhard Wolfinger show you how to get all the great functionality of the .NET Profiling API the easy way, with custom wrappers.

Joachim H. Fröhlich and Reinhard Wolfinger

MSDN Magazine April 2006

Test Run: Low-Level Web App UI Test Automation


As Web applications have become more complex, testing them has become more important. There are many testing techniques available to you. For example, in the April 2005 issue of MSDN®Magazine, I describe a simple JScript®-based system that can test a Web app through its UI by using the Internet Explorer Document Object Model.

James McCaffrey

MSDN Magazine October 2005

Test Run: Low-Level UI Test Automation


There are several ways to test a Windows®-based application through its user interface. For example, in the January 2005 issue of MSDN®Magazine (Test Run: Lightweight UI Test Automation with . NET) I described a lightweight technique for testing .

James McCaffrey

MSDN Magazine September 2005

Secure It: WS-Security and Remoting Channel Sinks Give Message-Level Security to Your SOAP Packets


As more organizations adopt XML-based Web Services, the need for message-level security has become evident. WS-Security, now supported in the Microsoft .NET Framework, addresses this need. Using the WS-Security framework, developers can implement channel sinks to intercept Remoting messages as they pass through the .NET Remoting infrastructure. The sink can read the message, change it, and pass it along. During this process, the message can be signed for added security. This article explains how to implement a Remoting channel sink that will modify the Remoting message by including a UserName token in the header, then sign the body using the token.

Neeraj Srivastava

MSDN Magazine November 2003

COM+ 1.5: Discover Powerful Low-Level Programming in Windows XP with New COM+ APIs


The new version of COM+ that ships as part of Windows XP includes APIs for low-level context programming. These functions allow you to create contexts that use COM+ runtime services, independent of objects and without registering anything in the COM+ Catalog. Designed for advanced COM+ developers who understand the COM+ context model, these APIs make it easy to integrate runtime services with code in nonstandard ways. This article explains how these low-level context APIs work, discusses when you'd want to use them, and provides a .NET-based wrapper to make it simpler to use the APIs from C#.

Craig Andera and Tim Ewald

MSDN Magazine April 2002

ASP.NET 4.0 Menu Top Level selected item style


I want to apply a css class to the level 1 menu item (parent) when it or any or it's children are selected.

I've looked at MSDN documentation and any number of examples and walkthroughs but I haven't come up with a way of managing this. I was thinking something like this might work but the style is not being applied to the parent. To further complicate matters, if I try to apply a css style to StaticSelectedStyle it doesn't pick it up at all.

Menu Markup:

<StaticSelectedStyle  Font-Bold="True" ForeColor="#3333CC" />

Code Behind:

        protected void MenuItemClick_NavMenu(Object sender, MenuEventArgs e)


            MenuItem parentItem = e.Item.Parent;

            if (parentItem != null)


                parentItem.Selected = true;



Top-Level Search Scope not showing in Sub-Site


I've got a site 'B' created under site 'A' in SharePoint. When I'm at Site A, I can search and find things that exist in both A&B. However, when I'm in B, the 'highest' search scope I can pick is 'B.' I'd like to be able to select one step higher so that I can search A&B from any page. Is this possible?

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend