Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
T-SQL query to LINQ
Message
From
20/10/2014 13:27:52
John Baird
Coatesville, Pennsylvania, United States
 
General information
Forum:
ASP.NET
Category:
LINQ
Environment versions
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01609660
Message ID:
01609664
Views:
46
>>Off the top of my head, if I understood your problem correctly. It would be something like this:
>>
>>var list = (from  d in _dbSet.Where(x => x.Account == accountName && x.Hidden == false)
>>               from t in transact .Sum(s=>s.extension).Where(w=>w.extension != null && w.invoiceNo == d.InvoiceNo).
>>              select(x => new InvoicesList { InvoiceNo = x.InvoiceNo, Account = x.Account, Hidden = x.Hidden, 
>>                                                          Descrip = x.Descrip1, Finalized = x.Finalized, Created = .DateTime}, InvoiceBalance= t)).ToList();
>>
>
>I am trying to use this syntax, but getting errors and can not figure this out. Here is my attempt, but I don't see where to put Sum here:
>
>
> var invoicesList =  (from  d in _dbSet.Where(x => x.Account == accountName && x.Hidden == false)
>                 from i in _siriusContext.Transact.Where(w=>w.Extension != null && w.InvoiceNo == d.InvoiceNo)
>                select(x => new InvoicesList { InvoiceNo = x.InvoiceNo, Account = x.Account, Hidden = x.Hidden, Descrip = x.Descrip1, Finalized = x.Finalized, Created = x.DateTime, Balance= i.Extension}))
>
My example had the sum in it... btw, what are the errors?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform