با سلام بر اساتید
لطفا بگید مشکل این کد چی هست که هی ارور مربوط به گرامر میده!!! به 2 سبک نوشتم ولی باز همان ارور را میده!!
من میخوام فقط فیلدusername و per را اپدیت کنم!!!
SqlCommand cmd = new SqlCommand();
cmd.Parameters.Clear();
cmd.Connection = con;
string sql = "update Tbl_User set username='{0}',per='{1}' where id={2}";
sql = string.Format(sql,txtuser.Text, txtper.Text,txtid.Text);
cmd.CommandText = sql;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("اطلاعات ویرایش شد");
string str_sql = "update Tbl_User set usernmae='" + txtuser.Text + "',per='" + txtper.Text + "' where id=" + txtid.Text;
SqlCommand cmd = new SqlCommand(str_sql, con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("اطلاعات ویرایش شد");
سپاس