title: Exception "Invalid column name 'False' with SqlConnection
body: <p>I'm getting an exception <em>Invalid column name 'False'</em> at the statement </p>
  
  <pre><code>reader = cmd.ExecuteReader(CommandBehavior.SingleRow);
  </code></pre>
  
  <p>I'm understanding that this may have something to do with SQL's boolean type being a "bit" and it not converting <code>false</code> to <code>0</code>. How do you mitigate that, or is that the issue here?</p>
  
  <pre><code>    public override bool ValidateUser(string username, string password)
      {
          bool isValid = false;
  
          SqlConnection conn = new SqlConnection(connectionString);
          SqlCommand cmd = new SqlCommand("SELECT Password, IsApproved FROM Users" +
                  " WHERE Email = @Email AND ApplicationName = @ApplicationName AND IsLockedOut = False", conn);
  
          cmd.Parameters.Add("@Email", SqlDbType.NVarChar, 128).Value = username;
          cmd.Parameters.Add("@ApplicationName", SqlDbType.NVarChar, 255).Value = m_ApplicationName;
  
          SqlDataReader reader = null;
          bool isApproved = true;
          string pwd = "";
  
          try
          {
              conn.Open();
  
              reader = cmd.ExecuteReader(CommandBehavior.SingleRow);
  
              if (reader.HasRows)
              {
                  reader.Read();
                  pwd = reader.GetString(0);
                  isApproved = reader.GetBoolean(1);
              }
              else
              {
                  return false;
              }
  
              reader.Close();
  
              if (CheckPassword(password, pwd))
              {
                  if (isApproved)
                  {
                      isValid = true;
  
                      SqlCommand updateCmd = new SqlCommand("UPDATE Users SET LastLoginDate = @LastLoginDate" +
                                                              " WHERE Email = @Email AND ApplicationName = @ApplicationName", conn);
  
                      updateCmd.Parameters.Add("@LastLoginDate", SqlDbType.DateTime).Value = DateTime.Now;
                      updateCmd.Parameters.Add("@Email", SqlDbType.NVarChar, 255).Value = username;
                      updateCmd.Parameters.Add("@ApplicationName", SqlDbType.NVarChar, 255).Value = m_ApplicationName;
  
                      updateCmd.ExecuteNonQuery();
                  }
              }
              else
              {
                  conn.Close();
  
                  UpdateFailureCount(username, "password");
              }
          }
  </code></pre>