Hi,
I have a DataSet,
and would like to step trough all the rows in one of the tables and delete them if an If clause returens true.
I tried:
For Each row In getFreeZimmerList.Tables(0).Rows
If getBelegungList(row.Item("ZimmerID".ToString, vonDate, bisDate).Tables(0).Rows.Count > 0 Then
row.Delete()
End If
Next
but It won't work since this changes the index of the dataset an then I can't step trough it anymore.
I also tried it with:
For I = 0 To getFreeZimmerList.Tables(0).Rows.Count - 1
If (getBelegungList(getFreeZimmerList.Tables(0).Rows(I).Item("ZimmerID".ToString, vonDate, bisDate).Tables(0).Rows.Count > 0) Then
getFreeZimmerList.Tables(0).Copy.Rows(I).Delete
End If
Next I
Same Problem.
Messes up the index.
Does anyone have suggestion on how to do this?
I thought of copping the "good" rows in a secound dataset and then override the first one with it.
But can't get that to work.
Thanks for any help
Johannes
I have a DataSet,
and would like to step trough all the rows in one of the tables and delete them if an If clause returens true.
I tried:
For Each row In getFreeZimmerList.Tables(0).Rows
If getBelegungList(row.Item("ZimmerID".ToString, vonDate, bisDate).Tables(0).Rows.Count > 0 Then
row.Delete()
End If
Next
but It won't work since this changes the index of the dataset an then I can't step trough it anymore.
I also tried it with:
For I = 0 To getFreeZimmerList.Tables(0).Rows.Count - 1
If (getBelegungList(getFreeZimmerList.Tables(0).Rows(I).Item("ZimmerID".ToString, vonDate, bisDate).Tables(0).Rows.Count > 0) Then
getFreeZimmerList.Tables(0).Copy.Rows(I).Delete
End If
Next I
Same Problem.
Messes up the index.
Does anyone have suggestion on how to do this?
I thought of copping the "good" rows in a secound dataset and then override the first one with it.
But can't get that to work.
Thanks for any help
Johannes