Results 1 to 2 of 2

Thread: [RESOLVED] DataTable.AddRow is very slow

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    Wisconsin
    Posts
    788

    Resolved [RESOLVED] DataTable.AddRow is very slow

    I am looping through around 500,000 records to compile a report in a nightly 'batch' process. In the old Visual Basic 6 app this process took less than 3 minutes. However I was finding that the C# way I am using was taking 50-60 minutes.

    The process is looping through some purchase history, matching, updating and adding it to a DataTable that will later be read and added to the database. This second DataTable ends up with around 12,000 unique records.

    I believe this is because when calling DataTable.AddRow(DataRow) it is updating notifications, doing index maintenance, and constraints. If I would have looked closer at the MSDN docs for DataTable I would have noticed this:
    http://msdn.microsoft.com/en-us/libr...(v=vs.90).aspx

    Since I changed to using DataTable.BeginLoadData and DataTable.EndLoadData the process is now sub 2 minutes.

    Any comments on another approach to this process are appreciated.

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    Wisconsin
    Posts
    788

    Re: DataTable.AddRow is very slow

    closing up

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width