PDA

View Full Version : سوال: مشکل در update کردن داده ها در mysql



reza69
جمعه 01 دی 1391, 12:19 عصر
سلام
من میخوام رکوردهای جدول mysql رو آپدیت کنم

private void btnupdate_Click(object sender, EventArgs e)
{
string myconstring = "server=localhost;database=regdata;uid=root;passwor d=123;";
MySqlConnection connection = new MySqlConnection(myconstring);
MySqlCommand cmd;
connection.Open();
try
{
cmd = connection.CreateCommand();
cmd.CommandText = "update regtable set name=" +
txtname.Text + ",family=" + txtfamily.Text + ",birthday=" + txtbirthday.Text + ",location= " +
txtlocation.Text + " where regcode=" + txtregcode.Text;
cmd.ExecuteNonQuery();
MessageBox.Show("The Record Is Updated.");
}
catch (MySqlException ex)
{
MessageBox.Show(ex.ToString());
}
connection.Close();
}

وقتی از این کد استفاده میکنم این ارور رو میده مشکل از کجاست؟
97029