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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PhanSoftware 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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
FairyBusinessAuthor Commented:
yep, can't believe I missed that!!
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.