开发者

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:

  1. Get all the WingsDossierID by doing a Distinct()
  2. Iterate through this list of WingsDossierID -- begin loop
    1. Get the group of records for the current WingsDossierID
    2. Commit some operation with the group of records
  3. end loop
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜