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 - email@example.com - strRQEmailID
2. Project Leader - firstname.lastname@example.org - strPLEmailID
3. Primary Contact - email@example.com - strPMEmailID
4. Admin Contact - firstname.lastname@example.org - strADEmailID
5. Technical Contact - email@example.com - strTCEmailID
6. 24HrSupport Contact - firstname.lastname@example.org - 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.