Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Quick Join to get the weight

Quick Join to get the weight

Scheduled Pinned Locked Moved Database
helpquestion
3 Posts 2 Posters 4 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jkirkerx
    wrote on last edited by
    #1

    I have this function that creates an order. I was missing a couple of things in the columns like weight, cost and profit. So I wrote this to just grab the cart items to calculate my missing data List sC = context.ORDERS_CART.Where(m => m.order_ID == pOrderID).ToList(); But then I came to the ship weight, which I need to get from PRODUCT_INFO. I forget the nomemclature for my expression above, so I wasn't able to search possibilities. Possible to do a quick join off sC into another list? If possible, I would need a little nudge towards getting it right. Thanks!

    If it ain't broke don't fix it

    Richard DeemingR 1 Reply Last reply
    0
    • J jkirkerx

      I have this function that creates an order. I was missing a couple of things in the columns like weight, cost and profit. So I wrote this to just grab the cart items to calculate my missing data List sC = context.ORDERS_CART.Where(m => m.order_ID == pOrderID).ToList(); But then I came to the ship weight, which I need to get from PRODUCT_INFO. I forget the nomemclature for my expression above, so I wasn't able to search possibilities. Possible to do a quick join off sC into another list? If possible, I would need a little nudge towards getting it right. Thanks!

      If it ain't broke don't fix it

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      Presumably you have a navigation property from the cart lines to the product info? In which case, you should be able to use something like:

      context.ORDERS_CART.Include(l => l.Product).Where(...

      which will load the product details with each line. You can then use the navigation property to access the product details for the line.


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      J 1 Reply Last reply
      0
      • Richard DeemingR Richard Deeming

        Presumably you have a navigation property from the cart lines to the product info? In which case, you should be able to use something like:

        context.ORDERS_CART.Include(l => l.Product).Where(...

        which will load the product details with each line. You can then use the navigation property to access the product details for the line.


        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

        J Offline
        J Offline
        jkirkerx
        wrote on last edited by
        #3

        I think I used include in a VB version of a situation that I needed extra details. Let me give that a spin. Monday I just looped the cart items and asked for the details and added them.

        If it ain't broke don't fix it

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups