Skip to content

Adding values to multiple tables via front end using .net

aarif nabi

Asked Jan 27, 2015, 1:15 AM EST1 answer
Share
LinkedInX












 sir i just had created  the database  know i want to add data to various tables connected via foriegn key relation from front end
 for a single table i used   datable  object and know tell me what to use  for various tables also tell me how to update the  corrosponding keysforeign of tables

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Mohan Raja
    +2
    Hi Aarif,

    Follow the below steps to achieve this scenario:
    1. Create a procedure by passing a header columns (Table1) as a parameter and passing detail columns (Table 2) as table formatted parameter.
    2. Next insert the header table with the parameter values and get the Identity by using @@IDENTITY keyword. (eg., SET _FK = @@IDENTITY)
    3. Now insert the detail table values and include the _FK field value in those tables.

    Hope this may help.
    +2