【发布时间】:2016-08-16 13:31:29
【问题描述】:
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();
}
我不太明白这个查询有什么问题,有人可以帮忙吗?
【问题讨论】:
-
在这里发布错误
-
您是否遇到异常或者这只是输出了错误的数据?请说明当您尝试执行此代码时当前的结果是什么,以及您期望它是什么。
-
也许您更改了列的数据类型或从表中删除的内容?请在此处显示完整的错误消息
-
如果没有更多信息或说明,我们可以给你一堆答案,这些答案都是合法的,但不能解决你的问题。