I have a simple update statement which updates locations where it is a certain Location. I am currently making a small desktop app where When I press a button, it will update and then display the records that were updated. How can I return the Ids of the records that were updated and then display those records in C#.
SqlCommand cmd = new SqlCommand(" update conset set location='LA' where deal in (select deal from dealset where location='LA') and locationid = 'NY'", con);
int rowsAffected = cmd.ExecuteNonQuery();
This however, only tells me the number of records that were updated not which ids were updated so I can query to display them. Help?
For example if 3 records were updated with the IDs: 1102, 1105, 111
Then it should display their Number based on the Id. However, I am unsure how I can do that. How would I loop through the updated results.