sábado, 8 de noviembre de 2014

Join in LinQ

' Consulta que utiliza join entre dos tablas
        Me.GridView1.Columns.Clear()
        Dim tblinvoices As List(Of Invoice) = InvoiceDB.GetInvoices
        Dim tblvendedor As List(Of Vendor) = VendorDB.GetVendors

        Dim tbllinq = From invoices In tblinvoices
                      Join vendedor In tblvendedor
                      On invoices.VendorID Equals vendedor.VendorID
                      Where invoices.InvoiceTotal > 3000
                      Order By vendedor.Name
                      Select invoices.InvoiceNumber,
                            invoices.InvoiceDate,
                            invoices.InvoiceTotal,
                            vendedor.Name,
                            vendedor.State

        gvEjemplo.DataSource = tbllinq.ToList

No hay comentarios:

Publicar un comentario