question

YvanRowel-7901 avatar image
0 Votes"
YvanRowel-7901 asked SeeyaXi-msft commented

Covert SQL to Linq

Hello,
I developed my program with C # using linq for the query. And I ran into a problem while converting my sql query to linq.
I don't know what to do, can you tell me the right query, please ..
Here is my sql query:

SELECT bs.idBalancesortie, bs.datesortie, bs.c_num_debut,bs.c_num_fin,bs.nombredetickets, n.quotite, bs.montant,
SUM(bs.montant) OVER(ORDER BY bs.idNature ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) as Cumul, bs.idNature
FROM BalanceSortie bs
LEFT JOIN Natures n on bs.idNature = n.idNature
order BY bs.idNature


[1]: /answers/storage/attachments/125424-res.jpg

sql-server-general
res.jpg (46.4 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.


Do you still have an SQL Server (“LINQ to SQL”), or do you need “LINQ to Objects”?

0 Votes 0 ·

Hi @YvanRowel-7901 ,

We have not received a response from you. Did the reply could help you? If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. By doing so, it will benefit all community members who are having this similar issue. Your contribution is highly appreciated.

0 Votes 0 ·
SimpleSamples avatar image
0 Votes"
SimpleSamples answered

Try LINQPad.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

SeeyaXi-msft avatar image
0 Votes"
SeeyaXi-msft answered SimpleSamples commented

Hi @YvanRowel-7901,

You can try the below tools to convert it.
https://www.linqpad.net/
http://www.sqltolinq.com/

Best regards,
Seeya


If the response is helpful, please click "Accept Answer" and upvote it, as this could help other community members looking for similar queries.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I saw Linqer | SQL to LINQ converter (http://www.sqltolinq.com) but there were enough negative comments about it that I did not mention it. I hope it is better than I got the impression it is.


0 Votes 0 ·