Home > Asp.net MVC > Cross join in LINQ

Cross join in LINQ

It is simple to implement to cross join in LINQ

Suppose i have 2 tables 1. Customers & 2.order

Now i want cross join on both tables

var q = from c in dataContext.Customers

             from o in dataContext.Orders

            select new {

                                     c.CustomerID,

                                   c.ContactName,

                                   a.OrderID,

                                  a.OrderDate

                           };

 

Thanks 🙂

This Article is TAGGED in , . BOOKMARK THE permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">