Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

Convert T-SQL to LINQ

$
0
0

Hi all,

I got stuck in converting T-SQL to LINQ as follows

select DISTINCT [ACCOUNT]
from [dbo].[BUDGET] b, [dbo].[OWNER] o
where b.FUND = o.FUND AND b.DEPARTMENT = o.DEPARTMENT AND b.PROGRAM = o.PROGRAM AND o.[USER_ID] = 'test'
      AND  SUBSTRING(b.ACCOUNT, 1, 1) != '0' AND SUBSTRING(b.ACCOUNT, 1, 1) != '1' AND SUBSTRING(b.ACCOUNT, 1, 1) != '2'
order by ACCOUNT
(from a in BUDGET
   ....
   where
     b.ACCOUNT.Substring(0,1) != "0" &&
     b.ACCOUNT.Substring(0,1) != "1" &&
     b.ACCOUNT.Substring(0,1) != "2"
   select ...)
).Distinct()
.OrderBy(a=>a)

I tried above conversion but It was not working. I really appreciate your help. Thanks in advance.


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>