title: check if a record exist in Sql with C#
body: <p>In my SQL Server database, I have records which are increments and sometimes I have some gaps in ID increments.</p>
  
  <pre><code>ID      Data     Data
  
  9857370  Data   (null)
  9857371 (null)  (null)
  9857375 (null)  (null)  
  9857376 (null)  (null)
  </code></pre>
  
  <p>We can see a gap in the increment of the ID.</p>
  
  <p>EDIT :</p>
  
  <p>I use C# with SQL for a ASP.net project.
  With a SQL request I select the Last ID in my database and in C# with OleDbDataReader I check each record if he hasn't (null) (null) like in my example and I decrement my ID until to have a Data in a column.</p>
  
  <p>But I can't check my record when he has a jump between 2 records.</p>
  
  <pre><code> ID      Data     Data
  
  9857371  (null)  (null)
  9857375  (null)  (null) 
  </code></pre>