title: How to quickly delete then insert multiple records into database
body: <p>I have an ASP.NET web application and I need to delete and insert multiple records in one shot.</p>
  
  <p>Let's say a user clicks on a button. It will delete all the existing records for this user and insert a new set of records into the database.</p>
  
  <p>For example, User A has 720 records in the database. When a user clicks on the <kbd>Update</kbd> button, it will delete the existing 700 records and insert a set of new records (let's say 854 records) into the database. </p>
  
  <p>This function will be used frequently by the user. </p>
  
  <p>I plan to do it in this way:</p>
  
  <ol>
  <li><p>Delete all records for a user</p></li>
  <li><p>Store all the records in a collection</p></li>
  <li><p>use a <code>foreach</code> to loop over the entire collection and insert records one by one</p></li>
  </ol>
  
  <p>But I am afraid there might be a performance issue. </p>
  
  <p>Is there any better way to do this?</p>