Answered multiple join reference, syntax?

  • Tuesday, August 19, 2008 10:04 PM
     
     

    Code  below does not compile but it seems obvious as VB.NET supports it but C# not... (I am missing something!)

     

    var query = from t in Texts

    join o in bookchapteralineas

    on t.BookChapterAlineaid equals o.bookchapteralineaid

    && t.AlineaId equals o.AlineaId

    select t;

     

     

    The red color errs.

     

    Thanks!

All Replies

  • Wednesday, August 20, 2008 12:28 AM
     
     Answered
    Hi Egbert

    You need to write the query as follows:

    from t in Texts

    join o in bookchapteralineas

    on new { t.BookChapterAlineaid, t.AlineaId } equals new { o.bookchapteralineai, o.ALineaId }

    select t



    Joe
  • Wednesday, August 20, 2008 6:07 AM
     
     

     

    wow,

    this is against the logic... Smile

    sure the C# designers knew what they did...

    But I would expect the former syntax to work.

     

    Thanks anyway,.