Link to home
Start Free TrialLog in
Avatar of FairyBusiness
FairyBusinessFlag for United States of America

asked on

Help with my C# error?

Hi, I am getting this error on my page:

No mapping exists from object type System.Web.UI.WebControls.TextBox to a known managed provider native type.

        protected void LogIn(object send, EventArgs e)
        {
            userEmail = loginEmail.Text.Trim();
            userPassword = loginPassword.Text.Trim();
            hashPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(userPassword, "sha1");
            //Response.Write(string.Format("<script type='text/javascript'>alert('login');</script>"));

            using (SqlConnection con = new SqlConnection(connectionString))
            {
                con.Open();

                // build the sql query
                query = "SELECT id, FirstName FROM Users WHERE Email = @email AND Password = @hashPassword LIMIT 1";

                // create the command object
                SqlCommand cmd = new SqlCommand(query, con);
                // parameters to protect from sql injection
                cmd.Parameters.AddWithValue("@email", email);
                cmd.Parameters.AddWithValue("@hashPassword", hashPassword);
                // execute the query
                cmd.ExecuteNonQuery();
                //Response.Write(string.Format("<script type='text/javascript'>alert('{0}');</script>", cmd));

                if (cmd.ExecuteNonQuery() > 0)
                {
                    completion succeededHeader = new completion("Success!");
                    succeededHeader.message(this.success);
                    completion succeeded = new completion("Login credentials  verified.");
                    succeeded.message(this.success);
                }
                else
                {
                    errors failHeader = new errors("Error:");
                    errors fail = new errors("The username or password you entered was incorrect.<br />Please make sure your caps lock key is off and try again.");
                    failHeader.message(this.error);
                    fail.message(this.error);
                }
            } // end using SqlConnection
        } // end LogIn method

Open in new window


Does anyone know what this means?

Login:
http://auroriella.com/user.aspx
ASKER CERTIFIED SOLUTION
Avatar of Ray Phan
Ray Phan
Flag of Viet Nam image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of FairyBusiness

ASKER

yep, can't believe I missed that!!
Thanks