Home > other >  SQL to LING Convert
SQL to LING Convert

Time:01-07

Select * from STK_Trans where STORETO =2199 and STOREFR = 2199 and TRANSDT BETWEEN '01/01/2023' AND '01/05/2023' Can anyone convert this sql comment to linq.

` from u in db.STK_Trans
                        where u.STORETO == stto &&
                        u.STOREFR == stid &&
                       (u.TRANSDT >= datefrom &&
                        u.TRANSDT <= dateto) select u;`

I use this but not working

CodePudding user response:

Something like this maybe:

var query = from u in db.STK_Trans
            where u.STORETO == 2199 &&
                  u.STOREFR == 2199 &&
                  u.TRANSDT >= new DateTime(2023, 1, 1) &&
                  u.TRANSDT <= new DateTime(2023, 1, 5)
            select u;
  • Related