none
SQL Query translate into LINQ...

    Discussão Geral

  • SELECT  ICITEM.ITEMNO, ICITEM.[DESC], MAX(PORCPL.DTARRIVAL) AS Expr1
    FROM     ICITEM INNER JOIN
                    PORCPL ON PORCPL.ITEMNO = ICITEM.ITEMNO
    WHERE  (ICITEM.ITEMNO LIKE '%R001%')
    GROUP BY ICITEM.ITEMNO, ICITEM.[DESC]

    my attempt at linq...

    Dim s = From items In db.ICITEMs
                    Where items.ITEMNO.Contains(Me.txtQuery.Text) Select items.ITEMNO, items.DESC
                    Join y In db.PORCPLs On ITEMNO Equals y.ITEMNO ???

    The point of all this is to use 's' as a datasource for a DataGridView...

    SOLVED:

                Dim s = From items In db.ICITEMs
                        Where items.ITEMNO.Contains(Me.txtQuery.Text) Or items.DESC.Contains(Me.txtQuery.Text)
                        Join recDates In db.PORCPLs On items.ITEMNO Equals recDates.ITEMNO
                        Group By items.ITEMNO, items.DESC Into MaxArrivalDate = Max(recDates.DTARRIVAL)
                        Select [ItemNumber] = ITEMNO, [Description] = DESC, MaxArrivalDate


    Works like a charm.

    segunda-feira, 27 de fevereiro de 2012 04:41

Todas as Respostas

  • Hi isaac2012,

    Welcome to MSDN Forum.

    I'm glad to hear that you have solved the issue and thanks for sharing the solution.

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    terça-feira, 28 de fevereiro de 2012 03:07
    Moderador