I have a simple stored procedure I'm using with my login form. My login form always returns false and I don't know why...

Here is the procedure

CREATE PROCEDURE [dbo].[LoginCheck]
(
    @Email varchar(50),
    @Password varchar(50)
) as
begin
    SET NOCOUNT ON;

    select MemberFirstName
    from Members
    where MemberEmail = @Email
      and MemberPassword = @Password
end
return

And here is my button method:

    protected void ButtonLogIn_Click(object sender, EventArgs e)
    {
        SqlConnection conn = new SqlConnection(@"data source = .\sqlexpress; integrated security = true; database = fitness_database");

        SqlCommand cmd = new SqlCommand();
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.CommandText = "LoginCheck";

        cmd.Connection = conn;

        try
        {
            conn.Open();

            SqlParameter pmUseEmail = new SqlParameter("@Email", TextBoxUsername.Text);
            SqlParameter pmUserPassword = new SqlParameter("@Password", TextBoxUsername.Text);
            cmd.Parameters.Add(pmUseEmail);
            cmd.Parameters.Add(pmUserPassword);

            SqlDataReader dr = cmd.ExecuteReader();

            if (dr.Read())
            {
                // Session["Logged"] = true;
                Label1.Text = "working";
            }
            else
            {
                Label1.Text = "not working";
            }
        }
        catch (Exception ex)
        {
            Label1.Text = ex.Message;
        }
        finally 
        { 
             conn.Close(); 
        }
    }
}

After submitting it always return "not working" Have any idea ?

Related posts

Recent Viewed