Solved

Detect duplicate entries in datatable rows

Posted on 2008-10-20
6
591 Views
Last Modified: 2013-11-05
Hi!

I have a datatable with the following columns:

givenname, surname, title, dept, identifier

Now I have thousands of rows like this for each user in the company:

Bill,Gates,,IT,1000

As some of the users have the same name, I have something like this:

Bill,Gates,,HR,2678

Now I want to detect these users and write the identifier (as this is unique) of these users to a list(of string).

How can I do that?

Thanks, Jan
0
Comment
Question by:janwrage
  • 3
  • 3
6 Comments
 
LVL 1

Accepted Solution

by:
janwrage earned 0 total points
Comment Utility
Hi again,

I know I could read one rows data (givenname, surname) and then loop thru the remaining and compare it to them.
But this is very time-consuming as for each entry, I need to loop thru all remaining rows and this is very slow.

Jan
0
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 200 total points
Comment Utility
I think if you use the group by clause in the SQL statement when loading data, it should group the names together and give you the count, For example
Select GivenName, Surname, Count(Surname) From Table Group By GivenName, Surname
0
 
LVL 1

Author Comment

by:janwrage
Comment Utility
How do I do that in VB?

The table is filled by some CSV-Parser, so no SQL...
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 83

Expert Comment

by:CodeCruiser
Comment Utility
Then you need to loop through the table i think. Or if you are using VB.NET 2008, try using LINQ. Check out these links
http://geekswithblogs.net/azamsharp/archive/2006/04/21/76054.aspx
http://www.codeproject.com/KB/vb/Merging_two_DataSets.aspx
0
 
LVL 1

Author Comment

by:janwrage
Comment Utility
Thx, I'll check it out.
0
 
LVL 83

Expert Comment

by:CodeCruiser
Comment Utility
did provide a solution which the asker choose not to implement
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Using MS Code on my Mac 6 44
.Net application crashing 6 19
VB.Net - For Loop Error 5 23
Closing all open child forms. 4 22
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now