Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
5.00/5 (2 votes)
hi 2 everybody
i want change this linq query to sql
C#
(from d in Context.OrderDetails
                        join p in Context.Products on d.ProductID equals p.ProductID
                        where d.OrderID==orderid
                        select new
                            {
                                d.DetailID,
                              p.ProductTitle,
                              d.ProductCount,
                              p.ProductPrice,
                                Psum = (from da in Context.OrderDetails where da.DetailID == d.DetailID select da.ProductCount * da.ProductPrice).FirstOrDefault()
                            }).ToList();
Posted

Have you looked at LinqPad LinqPad[^]?

This is a free utility for using Linq and it will convert the Linq to Sql.

I use it instead of Sql Manager in most cases.
 
Share this answer
 
You can see the query in visual studio debugger itself, just put a break point in that query and run it. when it hits the break point, just check it. you can see the query generated in the background.Basically while we run a linq query, the matching sql query is generated at the background that we are not aware of.

Please refer this Link[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900