PDA

View Full Version : سوال: مشکل آپدیت کردن جدول در mysql



reza69
شنبه 09 دی 1391, 23:03 عصر
سلام
چرا وقتی با C# اطلاعات رو به فارسی وارد می کنم وارد میشه ولی وقتی میخوام یه سطر رو update کنم به صورت علامت سوال"؟" ذخیره میشه؟


private void btnupdate_Click_1(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=@a,family=@b,birthday=@c,location=@d where regcode=@e";
cmd.Parameters.AddWithValue("@a", txtname.Text);
cmd.Parameters.AddWithValue("@b", txtfamily.Text);
cmd.Parameters.AddWithValue("@e", txtregcode.Text);
cmd.Parameters.AddWithValue("@c", txtbirthday.Text);
cmd.Parameters.AddWithValue("@d", txtlocation.Text);
cmd.ExecuteNonQuery();
MessageBox.Show("The Record Is Updated.");
}
catch (MySqlException ex)
{
MessageBox.Show(ex.ToString());
}
connection.Close();
}