title: Sql Dependency skips table row data
body: <p>I have an application that gets the user's actions, I subscribed the DB table
  <strong>user_actions</strong> (table columns: id [PK], action [int], date_created [datetime]) to SQL dependency. my problem is when I inserted 2 rows at the same time example: action=2 and action=3 then insert another 15 rows of action=2. The row for action=3 skipped sometimes action=2 as well.</p>
  <p>From my app it shows like:</p>
  <p>id: 1, action: 2<br />
  id: 2, action: 3 --- missing<br />
  id: 3, action: 2<br />
  id: 4, action: 2<br />
  id: 5, action: 2<br />
  id: 6, action: 2<br />
  id: 7, action: 2<br />
  id: 8, action: 2 --- missing<br />
  id: 9, action: 2<br />
  id: 10, action: 2<br />
  id: 11, action: 2<br />
  id: 12, action: 2 --- missing<br />
  id: 13, action: 2</p>
  <p>Does anyone experience the same thing as mine? what is the possible problem?</p>
  <p>Kind regards.</p>
  <p>Here is my code:</p>
  <pre><code>void Initialization()
  {
      // Create a dependency connection.
      SqlDependency.Stop(connectionString);
      SqlDependency.Start(connectionString);
      SqlDependencyInit();
  }
  
  void SqlDependencyInit()
  {
      using (var conn = new SqlConnection(connectionString))
      {
          conn.Open();
      
          // Create a new SqlCommand object.
          using (SqlCommand command = conn.CreateCommand())
          {
              command.CommandType = &quot;Text&quot;;
              command.CommandText = &quot;SELECT id FROM dbo.user_actions&quot;;
          
              command.Notification = null;
              
              // Create a dependency and associate it with the SqlCommand.
              SqlDependency dependency =  SqlDependency(command);
  
              // Subscribe to the SqlDependency event.
              dependency.OnChange+=new
             OnChangeEventHandler(OnDependencyChange);
  
              // Execute the command.
              command.ExecuteReader();
          }       
      }
  }
  
  void OnDependencyChange(object sender,SqlNotificationEventArgs e)
  {
      if (e.Info == SqlNotificationInfo.Insert) 
      {
          var id = Helper.ExecuteScalar(&quot;select top 1 id from user_actions order by id desc&quot;);
          processUserAction(id);
          SqlDependencyInit();
      }
  }
  </code></pre>