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
FairyBusinessAsked:
Who is Participating?
 
Ray PhanConnect With a Mentor Software DeveloperCommented:
Hi.
What is the "email" parameter in this line :
cmd.Parameters.AddWithValue("@email", email);
May be you want to use "userEmail".

Hope this help.

0
 
FairyBusinessAuthor Commented:
yep, can't believe I missed that!!
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.