MySQL和C# - '字段列表'中的未知列'电子邮件'

时间:2014-02-17 20:15:07

标签: c# mysql

我已经编辑了我的代码,出于某种原因我收到了这个错误。之前工作正常。无论如何,这是我的表单的登录代码:

string command = "SELECT email, password FROM uc_users WHERE email = @email";
        try
        {
            // COMMAND DETAILS
            MySqlCommand email = new MySqlCommand(command, connection);

            // PARAMETERS
            email.Parameters.AddWithValue("@email", txtEmail.Text);

            // READER DETAILS
            MySqlDataReader dr;

            // CHECK DETAILS               
            dr = email.ExecuteReader();
            if (!dr.Read()) 
            {
                MessageBox.Show("Invalid login details.");
            }

            string passwordC = dr.GetString(1);
            string saltedPass = Security.HashSalt.SaltedHash(txtPassword.Text);
            bool match = IsPasswordMatch(passwordC, saltedPass);

            if (match == true)
            {
                connection.Close();
                string email2 = txtEmail.Text;
                frmZilent frm = new frmZilent(email2);
                frm.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Invalid login details.");
                connection.Close();
            }
        }
        catch(MySqlException ex)
        {
            MessageBox.Show("MySQL Error - Code AHx004: " +ex.Message);
            connection.Close();
        }

顺便说一下,连接已经打开了。有什么想法吗?

0 个答案:

没有答案