title: How to check if mysql query returns nothing?
body: <p>I'm writing a project and at the some point i have to check if there is an entry in database which matches the content of <code>id-textbox</code> and <code>password-textbox</code>. But I don't know how to indicate in my backend code(VB) that the query returns nothing.</p>
  
  <p>This is the code I am using. But it doesn't work somehow. Error messages Are not being prompt:</p>
  
  <pre><code>Try
      myconn.Open()
      Dim stquery As String = "SELECT * from accountstbl WHERE user_ID = " &amp; IdNumb.Text
      Dim smd As MySqlCommand
      Dim myreader As MySqlDataReader
      smd = New MySqlCommand(stquery, myconn)
      myreader = smd.ExecuteReader()
      If myreader.Read() = True Then
          If myreader.Item("user_ID") = IdNumb.Text Then
              If myreader.Item("password") = CurrPass.Text Then
                  'some code if the user input is valid
               Else
                  errorPassID.Visible = True
               End If
          Else
             errorPassC.Visible = True
          End If
      End If
      myconn.Close()
  Catch ex As Exception
      Dim ErrorMessage As String = "alert('" &amp; ex.Message.ToString() &amp; "');"
      Page.ClientScript.RegisterStartupScript(Me.GetType(), "ErrorAlert", ErrorMessage, True)   myconn.Close()
  End Try
  </code></pre>
  
  <p>Will appreciate any help or suggestion.</p>