Solved

Detect duplicate entries in datatable rows

Posted on 2008-10-20
6
593 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
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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

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…
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

806 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