VB.Net - Comparison to figure out if there are duplicates
Posted on 2007-11-29
I have the following scenario. I have a SQL Server table that holds PERSON data such as name, address, phone number etc.. The Email_ID is the Primary Key. I have 6 kinds of Persons:
1. Requestor - firstname.lastname@example.org - strRQEmailID
2. Project Leader - email@example.com - strPLEmailID
3. Primary Contact - firstname.lastname@example.org - strPMEmailID
4. Admin Contact - email@example.com - strADEmailID
5. Technical Contact - firstname.lastname@example.org - strTCEmailID
6. 24HrSupport Contact - email@example.com - strTWEmailID
The persons in 1 and 2 (don't have to be) but they can be the same person.
The persons in 3,4,5,6 can be the same person also.
I have 6 separate strings that hold the email-ids of each. What I need to do is compare each email-id to the other and determine which ones are unique and which ones are duplicates. Then I need to discard the duplicates and INSERT only the ones that are unique. As I mentioned earlier, the EmailID is the Primary key.
Can someone please help with the logic of the code (in VB.Net). I don't have a code snippet to attach because I don't know where to begin.