title: ASP.net Entity Framework Check if exists in database
body: <p>I have VS2015, entity framework 6.  I have a database with one table (Logins)</p>
  
  <pre><code>FirstName, lastName, Birthdate, email, password
  </code></pre>
  
  <p>I also have a textbox(s), button </p>
  
  <pre><code>tbEmail tbpass and btnLogin
  </code></pre>
  
  <p>How do I check if the users email in the textbox matches one in the database?</p>
  
  <p>So far I have:</p>
  
  <pre><code> protected void btnLogin_Click(object sender, EventArgs e)
      {
              Logins Log = new Logins();
  
      using (LoginDataEntities lg = new LoginDataEntities())
      {
          string @email = tbUsernameL.Text;
          string @password = tbPassL.Text;
  
          var logged = from L in lg.Logins
                       where L.Username == @email
                       &amp;&amp; L.Pass == @password
                       select L.Username;
  
  
  
          if (logged != null) 
          {
              lblSuccess.Visible = true;
          }
          else
          {
              lblFail.Visible = true;
          }
  
  
      }
  }
  </code></pre>
  
  <p>However, its not working and always enables the success label.  How do I fix this?</p>