Friday, April 29, 2011

Linq Select Compound From

Hi, I'm experimenting with linq compount selects. I find the following query not to return any element:

            Dim q = From s In d.GetChildRows("DossierSinistri") _
                    From i In s.GetChildRows("DossierIncarichi") _
                    Select s

while the following does:

            Dim q = From s In d.GetChildRows("DossierSinistri") _
                    Select s

Any help?

From stackoverflow
  • Doesn't each query have to have its own select statement? From what I see, you are not selecting anything in the second from statement. Unless you are trying to use a join, in which case you would need to use a join statement.

    I could be misinterpreting your intention altogether. If you are trying to select a subset of s that is qualified by your i statement, you will need to qualify which i statements are used as a filter with a where statement.

  • I'm not selecting anything from the second query, i'll add it later on. But shouldn't it work this way anyhow?

  • To get the obvious out of the way, have you tried "Select i" instead of "Select s"?

    pistacchio : it doesn't return a thing either

0 comments:

Post a Comment