Set Isolation level without a transaction

Posts   
 
    
PilotBob
User
Posts: 105
Joined: 29-Jul-2005
# Posted on: 05-Feb-2007 19:49:12   

Does anyone know if the ADO.Net API allows for setting the transaction level without creating a transaction object?

I want to open a connection for a SELECT command without an implicit transaction? The only way I see to do it is to send the command text 'SET TRANSACTION ISOLATION TO READ UNCOMMITED' before sending the select command?

If possible I would rather have ADO.Net send the command in a batch with the select so there is not the extra traffic to the server.

If not, is there a way to know what IsolcationLevel is set on the connection pulled from the pool without sending a command to SQL Server?

Thanks, BOb

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39797
Joined: 17-Aug-2003
# Posted on: 07-Feb-2007 16:38:18   

The isolation level is for the transaction you set it for, so OTHER transactions can see/not see what you're doing.

So if you set the isolation level, it's for the transaction you're in, and it can only either be done by starting an explicit transaction, OR by sending the isolation level statement which sets the current transaction to the isolation level specified.

The connection objects don't know the state they represent on the server. So you can't determine this from the ado.net objects.

Frans Bouma | Lead developer LLBLGen Pro