views:

334

answers:

1

Hi all,

I've got a .net 3.5 website that calls thousands of different stored procs using Microsoft.Practices.EnterpriseLibrary.

We have been getting alot of timeouts and after some playing and testing the use of (nolock) on the end of the table join in stored procs works real well and reduces the timeouts.

I want to now do this to all sps. I could add (nolock) to all table names, however a better idea is to set the isolation level using in SQL "SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED"

I dont want to add this to the start of all sp's (as there are so many) so was looking for a way to add it to the connection.

An example of the code to call a sp is as follows

public static int ExecuteNonQuery(string sStoredProcedureName, params object[] parameterValues)
{
    Data.Database db = Data.DatabaseFactory.CreateDatabase();
    using (DbCommand command = db.GetStoredProcCommand(sStoredProcedureName, parameterValues))
    {
        return db.ExecuteNonQuery(command);
    }
}

I'm thinking this setting is a config setting in the web.config but cant figure out what it is, or if I'm on the right track.

Any help is really appreciated.

Cheers Amjid

+1  A: 

I assume you're using SQL Server?

Try setting READ COMMITTED SNAPSHOT on the database.

See here for more information:

http://www.codinghorror.com/blog/archives/001166.html

Robert Harvey
Sorry forthe late reply. That worked perfectly. It works accross teh board and there is no need for any code changes at all, except removing the (noLock) I've already put incheers
Amjid Qureshi
hmmmm yes...yes yes of course, indeed
Scozzard