csharp C#数据库更新
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp C#数据库更新相关的知识,希望对你有一定的参考价值。
MySqlConnection con = new MySqlConnection("server=localhost;userid=root;password=kodasdell;database=dev_db");
private void button3_Click(object sender, EventArgs e)
{
if (textBox4.Text != "" && textBox5.Text != "" && comboBox1.Text != "")
{
MySqlCommand cmd = new MySqlCommand("UPDATE dev_table SET "
+ comboBox1.Text
+"= '"
+ textBox5.Text
+ "' where id= "
+ textBox4.Text, con);
con.Open();
cmd.ExecuteNonQuery();
MessageBox.Show("Success!");
con.Close();
}
else { MessageBox.Show("There is empty field(s)!"); }
}
以上是关于csharp C#数据库更新的主要内容,如果未能解决你的问题,请参考以下文章