Fastest way to update DataTable

  • Thread starter Thread starter Hiroshi Nomura
  • Start date Start date
H

Hiroshi Nomura

Would anybody clarify what would be the fastest way to update contents of
DataTable ?
I need the fastest solution for real-time application.

Suppose the followng simple code.
How can I make this the fastest in terms of performance ?
I do not need any row-state (only current is important), no need on event
firing.
In this aspect, the DataTable is used simply as a buffer.

DataTable table; // already created
for ( int i=0; i<table.Rows.Count; i++)
{
table.Rows[1] = i;
}

The number of rows can be fairly large in my case.
The table is initialized in advance, with 10-400 columns dependending in the
case.

What makes me wonder is, the performance depends on the number of columns
in the table, although the code above only updates one column in each row.

It would be highly appreciated if anyone can explain :
* Why the performance is dependent on the number of columns ?
* Any way to minimize the performance dependency to the number of columns ?

Thanks & Regards,
// Hiroshi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top