2021年1月1日星期五

When i Update data for a user all user data change?

When i update any of the users all the other users updated to the data i entered example if i have two users sam and mark if i updated in sam the both rows be sam
//...................
SqlConnection con = new SqlConnection(@"Data Source=RADWAN;Initial Catalog=master;Integrated Security=True"); SqlCommand cmd = new SqlCommand("update users set username=@username , pass=@pass ,b_day=@b_day, addr=@addr ", con); cmd.Parameters.AddWithValue("@username", textBox1.Text); cmd.Parameters.AddWithValue("@pass", textBox2.Text); cmd.Parameters.AddWithValue("@b_day", textBox3.Text); // cmd.Parameters.AddWithValue("@ssn", textBox4.Text); cmd.Parameters.AddWithValue("@addr", textBox5.Text); con.Open(); int rowaff = cmd.ExecuteNonQuery(); if (rowaff > 0) { MessageBox.Show("updated"); } else { MessageBox.Show("Error in updating"); } con.Close(); i Tried to change it and put where condtion but it failed

https://stackoverflow.com/questions/65535398/when-i-update-data-for-a-user-all-user-data-change January 02, 2021 at 09:56AM

没有评论:

发表评论