to condition the where prob RRS feed

  • Question

  • hello what will be the best practice for conditional where in sub tables (so i dont have to select All the tables again and agan and using not too much code if possible - any how linq is new to me.. )
       var Orders1 = from ord in db.Orders           // Orders
           join od in db.Order_Details on ord.OrderID equals od.OrderID // Order_Details
           join p in db.Products on od.ProductID equals p.ProductID  // Products
           join c in db.Categories on p.CategoryID equals c.CategoryID // categories           
            //if( iProductID>0)
            // where p.ProductID == iProductID 
            //if( iCategoryID>0)
            // where c.CategoryID == iCategoryID
           select ord;
        var ord1 = from O in Orders1 
           where O.
        Orders = Orders.Where c.CategoryID == iCategoryID
         select Orders;
       // Orders = Orders.where p.ProductID == iProductID 
       //  select Orders; 

    Wednesday, January 26, 2011 11:18 AM