views:

30

answers:

1
A: 

This snippet should yield the result you are looking for.

using (StockProcedureDataContext stock = new StockProcedureDataContext())
{
    var items = from s in stock.StockMovements 
                where s.FromLocationType == FromLocationType &&
                s.FromNo== FromNo && 
                s.FromSeq == FromSeq &&
                s.ItemTypeNo == ItemTypeNo &&
                s.ItemID == ItemID 
                select s.Qty ?? 0;
    SumQtyOut = items.Sum(x => x);
}

select s.Qty ?? 0 returns 0 if s.Qty is null. items.Sum(x => x) summs up the quantities you have selected.

Obalix