Refresh Datatable

  • Thread starter Thread starter Oliver Seibert
  • Start date Start date
O

Oliver Seibert

Hi,

i have the follwing scenario:

...
DataTable myDataTable = new DataTable();
myDataAdapter.Fill(myDataTable);

while-loop{
DataRow[] myData = myDataTable.Select("....
...
Insert, Update Into the Sorce-Table
}
....

Erverytime when the while-Loop iterates i want to have the actual data in
"myDataTable".
So i included "myDataTable.Clear()" + "myDataAdapter.Fill(myDataTable);"
into the while-Loop-Body.

This works fine but is awfully slow.

Is there another way of "refreshing" the "myDataTable"-Object?
 
You could put the datatable in a dataset and merge it with the changes after
every iteration if you must have a fresh datatable everytime, and your
insert updates might change the datatable itself.

When .NET 2.0 rolls out, you could then replace dataset.merge with
datatable.merge.
 
Back
Top