title: C# Mysql row cannot validate
body: <p>I want to validate a QR code from a MySQL database. But the QR code is invalid and I want to access it into my program.</p>
  
  <p>How to validate it?</p>
  
  <pre><code>if (decodeStr == null) 
  {
      MessageBox.Show("There is no QR Code!");
  } 
  else 
  {
      player.Play();
  
      ConnectToDatabase();
      MySqlCommand cmd = new MySqlCommand("Select Name, LPN From visitors Where password = @password;", conn);
      cmd.Parameters.AddWithValue("@password", decodeStr);
  
      MySqlDataReader reader = cmd.ExecuteReader();
      while (reader.Read()) 
      {
          if(reader["password"].ToString() == decodeStr){
              //this is the problem here..
          }
          MessageBox.Show("he");
  
          name = reader["Name"].ToString();
          lpn = reader["LPN"].ToString();
      }
  
      CheckForIllegalCrossThreadCalls = false;
      //reader.Close();
      videoStream.Stop();
      this.Hide(); // closes the Form2 instance.
      Application.Run(new VisitorData());
  
  }
  </code></pre>