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/