try
            {
                conn.Open();

                MySqlCommand cmd = new MySqlCommand(@"UPDATE `users` SET `firstname`=@firstname,`lastname`=@lastname,`industry`=@industry,`companyname`=@companyname,`country`=@country,`addressone`=@addressone,`addresstwo`=@addresstwo,`city`=@city,`stateOrProvince`=@stateone,`zip`=@zip,`phone`=@phone,`companyphone`=@companyphone,`countrytwo`=@countrytwo,`citytwo`=@citytwo,`statetwo`=@statetwo,`ziptwo`=@ziptwo WHERE `email`=@email", conn);
                cmd.Parameters.AddWithValue("@firstname", firstName.Text);
                cmd.Parameters.AddWithValue("@lastname", lastName.Text);
                cmd.Parameters.AddWithValue("@industry", dropDownIndustry.Text);
                cmd.Parameters.AddWithValue("@companyname", companyInfo.Text);
                cmd.Parameters.AddWithValue("@country", countryTextbox.Text);
                cmd.Parameters.AddWithValue("@addressone", addressInfo.Text);
                cmd.Parameters.AddWithValue("@addresstwo", addresstwoInfo.Text);
                cmd.Parameters.AddWithValue("@city", cityTextBox.Text);
                cmd.Parameters.AddWithValue("@stateone", stateTextBox.Text);
                cmd.Parameters.AddWithValue("@zip", zipTextBox.Text);
                cmd.Parameters.AddWithValue("@phone", newphone);
                cmd.Parameters.AddWithValue("@companyphone", phonecompany);
                cmd.Parameters.AddWithValue("@countrytwo", countryTextBoxtwo.Text);
                cmd.Parameters.AddWithValue("@citytwo", cityTwoTextBox.Text);
                cmd.Parameters.AddWithValue("@statetwo", stateTwoTextBox.Text);
                cmd.Parameters.AddWithValue("@email", Session["email"]);
                cmd.ExecuteNonQuery();
                cmd.Parameters.Clear();
                serverErrorTextBox.Text = "Data updated Successfully...!" + companyPhoneTextBox.Text + " " + Session["email"] + "";
            }
            catch(MySqlException ex)
            {
                serverErrorTextBox.Text = ex.Message;
            }
            finally
            {
                conn.Close();
            }


我不能完全弄清楚此查询的问题是什么,有人可以帮忙吗,我正在使用它来更新用户信息,作为第一次脚本,所有帮助将不胜感激。

最佳答案

您没有ziptwo参数!在您的更新语句中

关于c# - 在执行命令期间遇到C#ASP.NET MySql致命错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38976333/

10-10 05:12