I found this link in code project. Maybe this might help you.
Eliminating Duplicate rows in Gridview.[
^]
I have a few thoughts that may help as I don't know all the specifics, but let me know if any of this points you in the proper direction.
1. What do you consider duplicate data? This question should prompt you to start thinking along the lines of what constitutes a duplicate such that you can find a remedy to your situation.
2. Before calling this function can you organize the data and remove duplicates before calling it? As a thought what about placing the data in a collection and try to see if you can find duplicates by iterating through all the collection. Not sure if that is a good idea because depending upon quantity of data it may be a bad idea.
3. As I have mentioned before I don't know the specifics, but I was faced in a situation similar to this (again I don't know your specifics). What I did to remedy my duplicates was to take care of it at the database level up creating multiple queries to merge 3 tables into one and remove all duplicates if any.
I hope these thoughts help. Don't give up :). Keep on programming!