C# ASP.NET MySql 命令执行过程中遇到 fatal error

标签 c# mysql asp.net

                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# ASP.NET MySql 命令执行过程中遇到 fatal error ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38976333/

相关文章:

php - 奇怪的 Codeigniter 查询转义

mysql - SQL查询-员工ID

mysql - 我的mysql用户定义函数有什么错误?

c# - 用 C# 编写一个简单的 Web 服务并从 Ruby on Rails 调用它

asp.net - 如何将数据表转换为没有对象列表或类列表的列表

c# - 一键打印多个 PDF 文件

c# - 需要了解如何获取/显示用户角色

html - asp.CheckBox 渲染显示在跨度内。样式属性以跨度结束,而不是复选框

java - 我无法在 Unity3D 中构建 Android 应用程序。错误 Gradle 初始化失败

c# - 扩展控件时调整窗口大小