Problem with while/foreach
I need to solve the following problem but I still dont know how.
First DataTable:
Name: WingsBookingInterface
Sample Data:
WingsBookingInterfaceId Columnx ColumnY WingsDossierID
1 x y 1
2 x y 1
3 x y 1
4 x y 2
Table: WingsBookingDetail
WingsBookingDetailId WingsBookingInterfaceId Columnx Columny
1 1 x y
2 1 x y
3 1 x y
4 开发者_运维技巧 2 x y
5 2 x y
I need to iterate through all the rows from the detail table that have the same DossierID in the master table.
Then I need to commit some operation with that group.
Then I need to continue the loop
I dont know how to do this, the only thing I have is the external loop
foreach (UC090_WingsIntegrationDataSet.WingsBookingInterfaceRow row in _uc090_WingsIntegrationDataSet.WingsBookingInterface.Rows)
{
dossierId = row.WingsYDossierID;
}
while(_uc090_WingsIntegrationDataSet.WingsBookingInterface.Rows.GetEnumerator().MoveNext())
{
UC090_WingsIntegrationDataSet.WingsBookingInterfaceRow row =
(UC090_WingsIntegrationDataSet.WingsBookingInterfaceRow)_uc090_WingsIntegrationDataSet.WingsBookingInterface.Rows.GetEnumerator().Current;
}
I don't know if it must be done with a foreach or a while? or what!!
I would do it this way:
- Get all the
WingsDossierID
by doing aDistinct()
- Iterate through this list of
WingsDossierID
-- begin loop- Get the group of records for the current
WingsDossierID
- Commit some operation with the group of records
- Get the group of records for the current
- end loop
精彩评论