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. Is this Possible in sql?

Is this Possible in sql?

Scheduled Pinned Locked Moved Database
databasehelpquestiontutorial
2 Posts 2 Posters 0 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.
  • M Offline
    M Offline
    majidbhutta
    wrote on last edited by
    #1

    In sql database , I have two tables named Emp_Info and Emp_Experience the structure of table is like this; Emp_Info ======== Emp_Id PrimaryKey(Auto) Emp_Name Emp_Age Emp_Experience ============== Exp_Id PrimaryKey(Auto) Emp_Id ForeignKey Exp_Detail Exp_Year . . . . ... and so on Working on a single form, All these fields have to be enterd and are saved against one button click.The Problem is how can i get the Emp_Id for Emp_Experience table to save Experince and Emp_Info paralelly.The relationship btw Emp_Info and Emp_Experience is one to many. that is, Against one Employee there may be none or many Experiences. in the scenario, i have to add Experiences first and then save the Employee? What 2 do? any guide line, help .....>? i need its stored procedure for saving Experiences. Thnx in Advance

    F 1 Reply Last reply
    0
    • M majidbhutta

      In sql database , I have two tables named Emp_Info and Emp_Experience the structure of table is like this; Emp_Info ======== Emp_Id PrimaryKey(Auto) Emp_Name Emp_Age Emp_Experience ============== Exp_Id PrimaryKey(Auto) Emp_Id ForeignKey Exp_Detail Exp_Year . . . . ... and so on Working on a single form, All these fields have to be enterd and are saved against one button click.The Problem is how can i get the Emp_Id for Emp_Experience table to save Experince and Emp_Info paralelly.The relationship btw Emp_Info and Emp_Experience is one to many. that is, Against one Employee there may be none or many Experiences. in the scenario, i have to add Experiences first and then save the Employee? What 2 do? any guide line, help .....>? i need its stored procedure for saving Experiences. Thnx in Advance

      F Offline
      F Offline
      Farhan Noor Qureshi
      wrote on last edited by
      #2

      Use something like, 1. Insert Into Emp_Info............ 2. Store newly created auto generated id in a local variable as, Select @newId = @@IDENTITY 3. Insert Into Emp_Experience....... and use @newId as fk here Farhan Noor Qureshi if (this == this) thow this;

      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