Private Function Com(ByVal ds1 As DataSet, ByVal ds2 As DataSet, ByVal ds3 As DataSet) As DataTable Dim i As Integer Dim j As Integer Dim havedata As Boolean Dim m As Integer For i = ds1.Tables(0).Rows.Count To 0 Step -1 havedata = False For j = 0 To ds2.Tables(0).Rows.Count - 1 If ds1.Tables(0).Rows(i)(0).Equals(ds2.Tables(0).Rows(j)(0)) Then For m = 0 To ds3.Tables(0).Rows.Count - 1 If ds1.Tables(0).Rows(i)(0).Equals(ds2.Tables(0).Rows(m)(0)) Then havedata = True End If Next End If Next If havedata = False Then ds1.Tables(0).Rows.RemoveAt(i) End If Next ds1.AcceptChanges() Return ds1.Tables(0) End Function
Dim i As Integer
Dim j As Integer
Dim havedata As Boolean
Dim m As Integer For i = ds1.Tables(0).Rows.Count To 0 Step -1
havedata = False For j = 0 To ds2.Tables(0).Rows.Count - 1 If ds1.Tables(0).Rows(i)(0).Equals(ds2.Tables(0).Rows(j)(0)) Then For m = 0 To ds3.Tables(0).Rows.Count - 1 If ds1.Tables(0).Rows(i)(0).Equals(ds2.Tables(0).Rows(m)(0)) Then
havedata = True
End If
Next
End If
Next If havedata = False Then
ds1.Tables(0).Rows.RemoveAt(i)
End If
Next
ds1.AcceptChanges()
Return ds1.Tables(0)
End Function