title: ADODB.RecordSet assigning value from objects in VB.NET performs badly
body: <p>We need to assign a ADODB.RecordSet from our .NET class objects and I am not sure if I am doing it right. Let's say I have a List called orderList which consists of objects of class <code>Order</code>, and I need to generate a RecordSet from this list (I have adodb as reference). My code looks like this:</p>
  
  <pre><code>Dim rs As Recordset = New Recordset
  rs.Fields.Append("ID", DataTypeEnum.adInteger)
  rs.Fields.Append("Sender", DataTypeEnum.adBSTR)
  rs.Fields.Append("Receiver", DataTypeEnum.adBSTR)
  ...
  rs.Open()
  
  For Each o In orderList
      rs.AddNew()
      rs.Fields("ID").Value = o.ID
      rs.Fields("Sender").Value = o.Sender
      rs.Fields("Receiver").Value = o.Receiver
      ...
  Next
  </code></pre>
  
  <p>In my test, when the list has 10000 objects, it takes relatively longt ime: over 3 seconds. This is slow since the number of orders could be as even over a million. I doubt I am using the <code>RecordSet</code> properly because as far as I learned the <code>RecordSet</code> normally perform direct connection to a table. It doesn't feel right to assign the records one by one. But this is the only way I can come up with (and some link suggests this. Although it doesn't mention about the performance there). We have our own Data Access Layer library and most of the target objects exist in the memory all the time, that's why we don't want to use RecordSet directly to database. </p>
  
  <p>So my question is, how should I modify my code to make it run fast? The "source" doesn't necessarily need to be a <code>List</code>. It can be any .NET type. But the target is I must have a <code>RecordSet</code> object since that's the input requirement from another component.</p>