title: how to append IQueryable within a loop
body: <p>I have a simple foreach loop that goes through the productID's I have stored in a user's basket and looks up the product's details from the database.</p>
  
  <p>As you can see from my code, what I have at present will return the very last item on screen - as the variable is overwritten within the loop. I'd like to be able to concat this so that I can display the product details for the items only in the basket.</p>
  
  <p>I know I could do something very easy like store only ProductIDs in the repeater I use and onitemdatabound call the database there but I'd like to make just one database call if possible.</p>
  
  <p>Currently I have the following (removed complex joins from example, but if this matters let me know):</p>
  
  <pre><code>IQueryable productsInBasket = null;
      foreach (var thisproduct in store.BasketItems)
      {
          productsInBasket = (from p in db.Products
                                   where p.Active == true &amp;&amp; p.ProductID == thisproduct.ProductID
                                   select new
                                   {
                                       p.ProductID,
                                       p.ProductName,
                                       p.BriefDescription,
                                       p.Details,
                                       p.ProductCode,
                                       p.Barcode,
                                       p.Price
                                   });
      }
  
      BasketItems.DataSource = productsInBasket;
      BasketItems.DataBind();
  </code></pre>
  
  <p>Thanks for your help!</p>