title: 'Invalid attempt to read when no data is present' error
body: <p>I've got this code block:</p>
  
  <pre><code>using (SqlConnection con2 = new SqlConnection(str2))
  {
      using (SqlCommand cmd2 = new SqlCommand(@"SELECT * FROM VW_MOS_DPL_AccountValidation WHERE CUST_NUM = @CNum", con2))
      {
          con2.Open();
  
          cmd2.Parameters.AddWithValue("@CNum", TBAccountNum.Text);
  
          using (SqlDataReader DT2 = cmd2.ExecuteReader())
          {
              // If the SQL returns any records, process the info
              if (DT2.HasRows)
              {
                  // If there's a BusinessID (aka Business Type), fill it in
                  string BizID = (DT2["Business_ID"].ToString());
                  if (!string.IsNullOrEmpty(BizID))
                  {
                      DDLBustype.SelectedValue = BizID;
                  }
              }
          }
          con2.Close();
      }
  }
  </code></pre>
  
  <p>When it gets to the line</p>
  
  <pre><code>string BizID = (DT2["Business_ID"].ToString());
  </code></pre>
  
  <p>it throws an error: </p>
  
  <blockquote>
    <p>Invalid attempt to read when no data is present.</p>
  </blockquote>
  
  <p>Why would it get past <code>if (DT2.HasRows)</code> if there was no data?</p>