Isolation Level

  • Thread starter Thread starter Vanaja Edara
  • Start date Start date
V

Vanaja Edara

Hi,
We have an Asp.Net applcation with Sql Server as back end. I have a
base class function that takes a SqlCommand Object as a parameter and
returns a datatable. I want to set the Isolation to "Read Uncommited" (Sql
Server's default Isolation Level is "Read Commited") as I am just selecting
some data from the tables. When I try to do the following :

objSqlCommand.Transaction.IsolationLevel = IsolationLevel.ReadUncommitted

The system says IsolationLevel is a Readonly property.

So the only option that I have currently is to set the Isolation Level to
"Read Uncommitted" in the Stored Procedures.

Is there a way to set it in the code so that I don't have to set it for each
stored procedure.

Thanks a lot.
 
Thanks a lot for repling Miha.

But do I have to use "Begin Transaction". The reason I am asking is because
I will be executing only SELECT Statements to display some data to the user.
I have not intention to update the data returned by the database. Is there
any other way to do this ?

Thanks,
Vanaja

Miha Markic said:
Hi Vanaja,

IsolationLevel is set on SqlConnection.BeginTransaction method.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Vanaja Edara said:
Hi,
We have an Asp.Net applcation with Sql Server as back end. I
have
a
base class function that takes a SqlCommand Object as a parameter and
returns a datatable. I want to set the Isolation to "Read Uncommited" (Sql
Server's default Isolation Level is "Read Commited") as I am just selecting
some data from the tables. When I try to do the following :

objSqlCommand.Transaction.IsolationLevel = IsolationLevel.ReadUncommitted

The system says IsolationLevel is a Readonly property.

So the only option that I have currently is to set the Isolation Level to
"Read Uncommitted" in the Stored Procedures.

Is there a way to set it in the code so that I don't have to set it for each
stored procedure.

Thanks a lot.
 
If you are using Sql Server then you can use the NOLOCK tsql statement:
http://www.developerfusion.com/show/1688/4/


--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no
rights.Please do not send email directly to this alias.
This alias is for newsgroup purposes only.

Vanaja Edara said:
Thanks a lot for repling Miha.

But do I have to use "Begin Transaction". The reason I am asking is because
I will be executing only SELECT Statements to display some data to the user.
I have not intention to update the data returned by the database. Is there
any other way to do this ?

Thanks,
Vanaja

Miha Markic said:
Hi Vanaja,

IsolationLevel is set on SqlConnection.BeginTransaction method.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Vanaja Edara said:
Hi,
We have an Asp.Net applcation with Sql Server as back end. I
have
a
base class function that takes a SqlCommand Object as a parameter and
returns a datatable. I want to set the Isolation to "Read Uncommited" (Sql
Server's default Isolation Level is "Read Commited") as I am just selecting
some data from the tables. When I try to do the following :

objSqlCommand.Transaction.IsolationLevel = IsolationLevel.ReadUncommitted

The system says IsolationLevel is a Readonly property.

So the only option that I have currently is to set the Isolation Level to
"Read Uncommitted" in the Stored Procedures.

Is there a way to set it in the code so that I don't have to set it
for
each
stored procedure.

Thanks a lot.
 
Back
Top