0
//get rows from db

foreach(DataRow r in rows)
{
//connect to some other database
//update some record in datatable
//insert record into datatable
//etc...
//...
}

How to use multiple threads mechanism to rewrite the above code, then we can get benefit from multiple servers?

user1033098
  • 205
  • 2
  • 7

1 Answers1

4

maybe this will help

IEnumerable<DataRow> items = ...

Parallel.ForEach(items, item => {
   ...
});

Parallel.ForEach

Community
  • 1
  • 1
Aram Beginyan
  • 294
  • 1
  • 4