title: Comparing results returned by query SQLite database
body: <p>I have written code for comparing user credentials in database. First I check the username and then based on the returned results, I compare the password. If both match, I open another activity. The code seems fine to me, but I have no experience in database stuff, I might be missing somehthing crucial here. The following code is not working for some reason.</p>
  
  <pre><code>public boolean Compare(String username, String pass)
  {
      Cursor c = sqlDB.query(DB_NAME, columns, DB_COL_EMAIL + "='" + username+ "'", null, null, null, null);
  
  
  
      if(c!=null &amp;&amp; c.getCount()&gt;0) 
      {
          Toast.makeText(context, "inside check", Toast.LENGTH_SHORT).show();
          c.moveToFirst();
  
          int passwordCol_number= c.getColumnIndex(DB_COL_PASS);
          boolean found = false;
  
          while(c.moveToNext())
  
          {
              found = pass.equals(c.getString(passwordCol_number));
  
              if(found)
                  return true;
          }
      }
   return false;
  }
  </code></pre>
  
  <p>Is there anything I am doing wrong? </p>
  
  <p>Regards</p>