sql - Display the records that were updated C# -


I have a simple update statement that updates the location where it is a fixed location. I am currently making a small desktop app where I press a button, it will be updated and then display updated records. How can I return the ID of those records which were updated and then those records were shown in C #

  SqlCommand CMD = New SQL Commands ("Delete Setset Location = 'LA' where deals in deal (deals where deals with location = 'LA') and locationid = 'NY'" Who) ; Int: Rows Affected = cmd.ExecuteNonQuery ();   

It only tells me that the number of records was not updated which did not update the ID, so I can query them to display. help?

For example if 3 records were updated with ID: 1102, 1105, 111

then their number based on ID should be displayed. However, I'm sure how can I do this. How do I loop through updated results?

I use one and DataReader : < Pre> string sql = @ "update c set c.location = 'LA' Output INSERTED.IdColumn from ConsecutC WHERE deal (deals with select deal WHERE location = 'LA') and c.locationid = 'NY'; "; & Lt; Integer & gt; UpdatedIDs = new list & lt; Int & gt; (); (Var cnd = new SQL command (SQL, con)) using (con con) (var con = new SQL connection (properties setting. Default.connection string); (Var rd = cmd When using ExecuteReader (), click on {rd (read ()) {updatedIDs.Add (rd.GetInt32 (0));}}}

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -