DataTable Returns no records from Database. Why is that?

I want to return records on the basis of two parameters, EmployeeNo and Password. What i mean is that when a user enter his/her credentials like EmployeeNo and Password then first program check if its present in the database or not. But i have a problem with the datatable. Datatable has no rows. Following is my code, which seems Okay to me but i have no idea why its not working. Here is my code

protected void btnLogin_Click(object sender, EventArgs e)
    {
        using (SqlConnection con = new SqlConnection(Base.GetConnection))
        {
            SqlCommand cmd = new SqlCommand("SELECT * FROM TableUserProfile WHERE UserEmpNum=@UserEmpNum and UserPassword=@UserPassword", con);
            cmd.CommandType = CommandType.Text;
            cmd.Parameters.AddWithValue("@UserEmpNum", tbEmpNumber.Text);
            cmd.Parameters.AddWithValue("@UserPassword", tbPassword.Text);
            con.Open();
            SqlDataAdapter ad = new SqlDataAdapter(cmd);
            DataTable dt = new DataTable();
            ad.Fill(dt);
        cmd.ExecuteNonQuery();
        if (dt.Rows.Count != 0)
        {
            if (cbRememberLogin.Checked)
            {
                Response.Cookies["UEmpNo"].Value = tbEmpNumber.Text;
                Response.Cookies["UPass"].Value = tbPassword.Text;
                Response.Cookies["UEmpNo"].Expires = DateTime.Now.AddDays(15);
                Response.Cookies["UPass"].Expires = DateTime.Now.AddDays(15);
            }
            else
            {
                Response.Cookies["UEmpNo"].Expires = DateTime.Now.AddDays(-1);
                Response.Cookies["UPass"].Expires = DateTime.Now.AddDays(-1);
            }

            Session["UserEmployee"] = tbEmpNumber.Text;
            Response.Redirect("~/UserProfile.aspx");
        }
    }
}

When i put my program on a debug mode, it retrieve nothing, Here is the pic 

Here is my Database Table 


#c-sharp #database #asp.net

4 Likes1.45 GEEK