title: Snapshot Isolation Transaction aborted due to update conflict, but no transaction begins
body: <p>I have encountered an error on executing UPDATE statement.</p>
  
  <p>Error:</p>
  
  <blockquote>
    <p>Snapshot isolation transaction aborted due to update conflict. You
    cannot use snapshot isolation to access table 'dbo.Companies' directly
    or indirectly in database 'myDatabase' to update, delete, or insert
    the row that has been modified or deleted by another transaction.
    Retry the transaction or change the isolation level for the
    update/delete statement.</p>
  </blockquote>
  
  <p>Statement: </p>
  
  <pre><code>UPDATE [ActiveSession] SET [LastActionExecutedAt] = GETDATE() WHERE [SessionID]=@id
  </code></pre>
  
  <p>I ran above statement through ASP.NET application.</p>
  
  <p>What is curious is that the statement is executed WITHOUT transaction.
  The code is like below:</p>
  
  <pre><code>using(var sqlconn = new SqlConnection("connection string")
  using(var sqlcmd = sqlconn.CreateCommand())
  {
      sqlconn.Open();
      sqlcmd.Parameters.Add("@id", SqlDbType.NVarChar).Value = id;
  
      sqlcmd.CommandText = "SELECT * FROM [ActiveSession] WHERE @id=id";
      using(var sqlreader = sqlcmd.ExecuteReader())
      {
          // read info
          reader.Close();
      }
  
      sqlcmd.CommandText = "UPDATE ....";
      Sqlcmd.ExecuteNonQuery();
  }
  </code></pre>
  
  <p>I have googled and only find that the error occurs when I use SNAPSHOT isolation level transaction. BUT there is no transaction.</p>
  
  <p>As described in <a href="https://stackoverflow.com/questions/10718668/snapshot-isolation-transaction-aborted-due-to-update-conflict">this thread</a>, INDEXING will help in some situations, but this does not help me.</p>
  
  <p>Any idea about this error? Any help will be appreciated.</p>
  
  <p>Thanks,</p>