Posted on: 6/9/2013 2:52:23 PM | Views : 354

Hi 
I need help writing this loop in C#.
I am returning the following collection to a method. I have to loop through the collection, writing the unique userids to a 'header' table and writing the 'detail' for each user to another table. (with a ID as reference to the Header table)
Collection:
User AdId Sam 1000 Jack 1000 Sam 2000 Jack 3000 The result I require written into the Header Table:
Id User 1 Sam 2 Jack and the detail table:
Id HeaderId AdId 1 1 1000 2 1 2000 3 2 1000 4 2 3000 My reason for doing this; All these ads are later emailed to the users. And I need a unique Id for each email for tracking. In above example two emails will be sent - One to each user and each email containing 2 ads.
So the loop needs to do something like this: Loop through the unique ...

Go to the complete details ...