Solved

Detect duplicate entries in datatable rows

Posted on 2008-10-20
6
595 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
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

697 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