title: C# Check if value is returned from database
body: <pre><code> SqlCeConnection sqlCnn = new SqlCeConnection("Data Source=" + Application.StartupPath + "\\mainDB.sdf");
   SqlCeCommand sqlCmd = new SqlCeCommand("SELECT * FROM Accounts WHERE (username = @user AND password = @pass)", sqlCnn);
   sqlCmd.Parameters.Add("@user", textBox1.Text);
   sqlCmd.Parameters.Add("@pass", textBox2.Text);
   sqlCnn.Open();
   SqlCeDataReader reader = sqlCmd.ExecuteReader();
   while (reader.Read())
   {
      // Some code ...
   }
  </code></pre>
  
  <p>I have this code that reads some values from a database but I want to check if any value is returned from the database. I want to check if the <code>username</code> and <code>password</code> from the database is equal to <code>textBox1</code> and <code>textBox2</code> and if not, return a failure message.</p>