How to save two related datatable in database at once? RRS feed

  • Question

  • Hi to all,


    First i am very sorry for my weak english.


    I have a form having a dataset at form level and containing two tables which are filled on the form load event by two tables. First by "Class" and second by "Section" table with the help of data adapter.


    The structure of table is ::



    ClassID Integer (PK)

    ClassName varchar(50)




    SectionID Integer(PK)

    ClassID Integer(FK)

    SectionName varchar(50)


    Their is parent child relation in table class and section.


    To saving the datatable "class" and "section " in database first i popup the datatables contained in the dataset of form level. I use commandBuilder object to save the data in database.


    Then I save the data of "class" in database using dataadapter and command builder.


    Then I required to reinitialize the dataAdapter and commandBuilder to save the data of "section" in database.


    I want to know if datarelation exists in both datatable in dataset then is it possible to save the data of both datatable in database at once without reinitializing the dataadapter and command builder

    Tuesday, December 11, 2007 12:13 PM