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. General Programming
  3. LINQ
  4. entity framework insert record problem

entity framework insert record problem

Scheduled Pinned Locked Moved LINQ
2 Posts 2 Posters 3 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.
  • U Offline
    U Offline
    uglyeyes
    wrote on last edited by
    #1

    Hi! I have 3 tables A, B and C I am trying to insert a record in C. C has foreign key value coming from A and B. A has foreign key to B. I have access to all the data to be inserted to C except the data from B. I need the way to pull up the object of B based on foreign key id of A in B. here is the code snippet entities.AttachTo("A", C.A); entities.AttachTo("B",C.B); <-- here i can get the value of B. but it is accessible via A's Id in B. (i.e. select id from B where Aid = ID)--I need this as object. entities.AddToConfigKey(C); entities.SetLink(C, "A", C.A); entities.SetLink(C, "B",C.B); columns in C are something like this id - autoid A's Id B's Id please help

    D 1 Reply Last reply
    0
    • U uglyeyes

      Hi! I have 3 tables A, B and C I am trying to insert a record in C. C has foreign key value coming from A and B. A has foreign key to B. I have access to all the data to be inserted to C except the data from B. I need the way to pull up the object of B based on foreign key id of A in B. here is the code snippet entities.AttachTo("A", C.A); entities.AttachTo("B",C.B); <-- here i can get the value of B. but it is accessible via A's Id in B. (i.e. select id from B where Aid = ID)--I need this as object. entities.AddToConfigKey(C); entities.SetLink(C, "A", C.A); entities.SetLink(C, "B",C.B); columns in C are something like this id - autoid A's Id B's Id please help

      D Offline
      D Offline
      designit99
      wrote on last edited by
      #2

      Hi there, Did you work this out? Cheers

      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