Solved

Detect duplicate entries in datatable rows

Posted on 2008-10-20
6
597 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 1

Accepted Solution

by:
janwrage earned 0 total points
ID: 22756079
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
ID: 22756132
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
ID: 22756153
How do I do that in VB?

The table is filled by some CSV-Parser, so no SQL...
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
LVL 83

Expert Comment

by:CodeCruiser
ID: 22756183
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
ID: 22756257
Thx, I'll check it out.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 22766500
did provide a solution which the asker choose not to implement
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

626 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