Question : How can i use “COALESCE(SUM…” in linq?


How can i use “COALESCE(SUM…” in linq?

0
      

i try to use sum and Coalesce . How can i translate to linq?

 SELECT @SumQtyOut=COALESCE(SUM(Qty),0) FROM dbo.StockMovement WHERE FromLocationType=@FromLocationType AND
         * FromNo=@FromNo AND FromSeq=@FromSeq AND ItemTypeNo=@ItemTypeNo AND ItemID=@ItemID

i do something but :

1:
2:
3:
4:
5:
6:
7:
8:
9:
 using (StockProcedureDataContext stock = new StockProcedureDataContext())
                {
                    SumQtyOut = from s in stock.StockMovements 
                                where s.FromLocationType == FromLocationType &&
                                s.FromNo== FromNo && 
                                s.FromSeq == FromSeq &&
                                s.ItemTypeNo == ItemTypeNo &&
                                s.ItemID == ItemID select 
                }

Answer : How can i use “COALESCE(SUM…” in linq?

I think this is a simpler approach
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
#!/bin/bash

cd /some/path

for dir in simrun*
do

  while true
  do
    if [ $(jobs | wc -l) -gt 8 ]
    then
       sleep 1
    else
       $dir/simrun <FCON> $dir/$dir.out &
       break 2
    fi
  done

done
~
Random Solutions  
 
programming4us programming4us