title: Get the selected id index position from SqlDataReader
body: <p>In my Winforms app, I have a find option. When the user enter an id of my table (note: my <code>id</code> is the primary key) I will show the details of particular id that was entered. I store that particular record in datareader and I will display that particular data into textbox fields. </p>
  
  <p>Like this:</p>
  
  <pre><code>if (reader.Read())
  {
    btnNext.Enabled = true;
    btnPrevious.Enabled = true;
    txtname.Text = reader["name"].ToString();
    .....
  }
  </code></pre>
  
  <p>Along with that I have next and previous buttons. So he find data according to that id then he want to see the next record from find id.</p>
  
  <p>I will capture the id of the index position so that I can easily display the next record as well as previous too. How to get id position? Can anyone help?</p>
  
  <p>I displayed next record on my next button like below:</p>
  
  <pre><code>  if (dt.Rows.Count &gt; 0)
     {
     if (count &lt; dt.Rows.Count - 1)
     {
     count += 1;
     ShowData();
     }
     else
     {
     MessageBox.Show("Last record of the table.");
     }
     }
  </code></pre>