Note that there are some explanatory texts on larger screens.

plurals
  1. POIsolation level in Sql Transaction
    primarykey
    data
    text
    <p>I have implemented <code>SqlTransaction</code> in c# to begin, commit and rollback transaction. Everything is going right, but I've got some problem while accessing those tables which are in connection during transaction. I was not able to read table during the transaction(those table which are in transaction). While searching about this, I found that it happens due to an exclusive lock. Any subsequent selects on that data in turn have to wait for the exclusive lock to be released. Then, I have gone through every isolation level provided by <code>SqlTransaction</code>, but it did not work. So, I need to release exclusive lock during transaction so that other user can have access on that table and can read the data. Is there any method to achieve this? Thanks in advance.</p> <p>Here's my c# code for the transaction </p> <pre><code>try { SqlTransaction transaction = null; using (SqlConnection connection=new SqlConnection(Connection.ConnectionString)) { connection.Open(); transaction=connection.BeginTransaction(IsolationLevel.Snapshot,"FaresheetTransaction"); //Here all transaction occurs if (transaction.Connection != null) { transaction.Commit(); transaction.Dispose(); } } } catch (Exception ex) { if (transaction.Connection != null) transaction.Rollback(); transaction.Dispose(); } ` </code></pre> <p>This code is working fine, but the problem is that when I access the data of tables (those accessed during the transaction) during the time of transaction. The tables are being accessed by other parts of the application. So, when I tried to read data from the table, it throws an exception.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload