How to avoid duplicated when merging two tables

I want to merge two tables but I found duplicated IDs in result table dt30.   How to avoid?
Any comment or instruction will be appreciated!!


         //DataTable dt30 = new DataTable();
            //DataTable dt60 = new DataTable();
            //dt30 = ReportsUtility.GetFormExceptionsList(LeftIDs, RightIDs, POHData.DAOs.Reports.DQ.DqFormExceptionsDao.ReportTypes.ThirtyDayExceptions);
            //dt60 = ReportsUtility.GetFormExceptionsList(LeftIDs, RightIDs, POHData.DAOs.Reports.DQ.DqFormExceptionsDao.ReportTypes.SixtyDayExceptions);
            //dt30.Merge(dt60);
            //Exceptions.Tables.Add(dt30);
jssong2000Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jacques Bourgeois (James Burger)PresidentCommented:
Your GetFormExceptionList method probably calls Fill to fill the tables. This retrieves the field names and the data, but nothing more.

Have it call FillSchema before calling Fill so that the DataTable knows which field is the PrimaryKey.

You might also look the documentation for the following overload of Merge: http://msdn.microsoft.com/en-us/library/wtk78t63(v=vs.80).aspx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jssong2000Author Commented:
Thank you!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.