1

I am using a set of DataTables to store values continuously, from which I have to delete n number of rows.

My problem is,

  • when the number of rows reach a limit i have to delete n rows.
  • Deletion should not affect the other writing processes in the Datatable.

Please help me to solve this problem /or give suggestions

Edit from heading

I want to use a method which doesn't have an iteration in it.

madth3
  • 7,275
  • 12
  • 50
  • 74
  • are the rows which you want to delete a range? or are there gaps? http://stackoverflow.com/a/8225055/169714 – JP Hellemons Aug 28 '12 at 13:16
  • Yes a range of every 1000 records – Suresh Krishnamoorthi Aug 29 '12 at 07:02
  • Why don't you use something like this: `delete from Table where id between 1000 and 2000` – JP Hellemons Aug 29 '12 at 07:11
  • Thanks for you reply . Actually the datatable is not from database it is a C# datatable – Suresh Krishnamoorthi Aug 29 '12 at 11:12
  • So it is a `List` of objects? http://msdn.microsoft.com/en-us/library/y33yd2b5.aspx – JP Hellemons Aug 29 '12 at 12:13
  • Thanks for your comment. No it is not a list. I get value from a callback event and store it in a temporary table and after reaching n records , i insert n records to database and want to delete the first n records from the datatable , so that the values retrieved from callback event after n rows will not be deleted – Suresh Krishnamoorthi Aug 30 '12 at 04:21
  • 1
    So you are looking for a persistent queue pattern? http://en.wikipedia.org/wiki/Queue_%28abstract_data_type%29 – JP Hellemons Aug 30 '12 at 07:55
  • Give some primary key for the table, then U can delete the rows with in range using P'key – Sarin Jacob Sunny Sep 03 '12 at 05:17
  • You need to delete the records that have been inserted to database right? You will have a method call to update database from datatable. In the same method delete each row after updating in database. – Rockstart Sep 12 '12 at 05:15
  • @Rockstart Thanks for your comment. But I am not follow the row by row insertion. I copy first n records to an xml file and then insert into the database table by a single Load xml query. Actually i want to remove the n records from the datatable without using iteration. – Suresh Krishnamoorthi Sep 13 '12 at 02:47

0 Answers0