tags:

views:

25

answers:

1

Let's say we have a DataTable with rows say:

ROW1
ROW2
ROW3
ROW4
ROW5

ROW3 has been deleted. I would like to clarify if the rows strictly follow the order of:

ROW1
ROW2
ROW4
ROW5

... or the order of ROW4 and ROW5 may change?

Thanks

A: 

The rows will strictly follow the order as you have given.

On an aside: If you call DataTable's RejectChanges() method after two or more rows are deleted, they may not be reversed in the expected order. There was a bug reported for this but I dont know if it was corrected.

http://connect.microsoft.com/VisualStudio/feedback/details/95389/datatable-rejectchanges-should-rollback-rows-in-reverse-order

Mamta Dalal
Thanks Mamta. By the way, do you have a link to your first answer?
yoitsfrancis
Technically speaking, the rows that are deleted in the DataTable are only marked with RowState as "Deleted". But the order remains intact.Here's one link I found that discusses something similar:http://www.tech-archive.net/Archive/DotNet/microsoft.public.dotnet.languages.csharp/2009-06/msg00733.html
Mamta Dalal