title: How to enforce a certain number or range of affected rows in SQL Server or ASP.NET C#
body: <p>for some SQL queries I know the expected number of rows that must be affected by UPDATE, DELETE or INSERT statements. It could be a number such as 1 or a range such as 0-1 or 1-2 etc.</p>
  
  <p>What is the best way to enforce that this is the number of affected rows and that otherwise an exception is thrown?</p>
  
  <p>Also, can I limit the number of rows affected for UPDATE/DELETE/INSERT to say 1 row and otherwise get an exception?</p>
  
  <p>Thanks</p>