title: Read data from a SQL server
body: <p>I have a Table with the name "MyTable". I want to read the "Active3" column When the "ID3" column is an specified value. But I get this error: Invalid attempt to read when no data is present.</p>
  
  <pre><code>    Dim con1 As New SqlConnection(connectionString)
      con1.Open()
      Dim sql1 As String = String.Format("SELECT Active3,DateTime3,BuyDateTime3 FROM MyTable WHERE ID3='{0}'", Session("lblID8"))
      Dim command1 As SqlCommand = New SqlCommand(sql1, con1)
      Dim reader As SqlDataReader = command1.ExecuteReader
  
      If reader.HasRows Then
          Label4.Text = reader("Active3")
      else 
  
      End If
     con1.Close()
  </code></pre>