My oldest daughter is suppose to go to court Friday. It might possibly be delayed, but I got to tell you nothing pains a parent more than watching one’s child suffer needlessly. We struggle, we beg, we plead but to no avail. Is it a reflection on myself as a parent? This is the question I struggle with most. I know I could have done some things better. I know there were some things I have done that were right. But I can’t save her anymore and that part just drives me crazy.
Anyway, wrote this little routine to remove duplicate rows from a dataset that has no primary key. How did I end up with a dataset without a primary key? Well that I can’t answer because I didn’t have any control over it.
Make it a great day! And I will try, really I will try, to do that.
Sub EliminateDuplicates(ByVal dt As DataTable)
Dim ssort As String = ""
Dim col As DataColumn
Dim scol As DataColumn
For Each scol In dt.Columns
If ssort <> "" Then ssort &= ","
ssort &= scol.ColumnName
dt.DefaultView.Sort = ssort
Dim i As Integer, bEquals As Boolean, c As Integer, ccount As Integer
ccount = dt.Columns.Count
For i = dt.Rows.Count – 1 To 1 Step -1
bEquals = True
For c = 0 To ccount – 1
If dt.DefaultView(i)(c).ToString() <> dt.DefaultView(i – 1)(c).ToString() Then
bEquals = False
If bEquals Then