title: Insert records into a database from a hashtable
body: <p>I'm looking for any advice on what's the optimum way of inserting a large number of records into a database (SQL2000 onwards) based upon a collection of objects.  </p>
  
  <p>Currently my code looks something similar to the snippet below and each record is inserted using a single sql simple INSERT command (opening and closing the database connection each time the function is called! - I'm sure this must slow things down?).</p>
  
  <p>The routine needs to be able to cope with routinely inserting up to 100,000 records and I was wondering if there is a faster way (I'm sure there must be???).  I've seen a few posts mentioning using xml based data and bulk copy routines - is this something I should consider or can anyone provide any simple examples which I could build upon?</p>
  
  <pre><code>foreach (DictionaryEntry de in objectList)
  {
    eRecord record = (eRecord)de.Value;
  
    if (!record.Deleted)
    {
      createDBRecord(record.Id,               
                     record.Index,
                     record.Name,
                     record.Value);
    }
  }
  </code></pre>
  
  <p>Thanks for any advice,</p>
  
  <p>Paul.</p>