SQL Store procedure

  • Hi Sir,

    Iam new in SQL.I need the solution for a store procedure.How create a store procedure that help me to insert the data more then on table haveing Primary key & Forigen Key concept....

    For Example.......class table.....cls_id(PK),cls_name,cls_strength,cls_group....

    ,,,,subject table......sub_id(PK),sub_name,sub_description......

    Q..How we save the data when we click on botten only field the cls_name,cls_strength,cls_cls_group and with it subject table data from grid view only selected items(subject) will be saved????

    we have check boxes in gridview so only checked subject will saved we class????

    Raghu

  • You, as programmer decide what is to be saved. If you have a grid with subjects for a class, they won't be saved unless you implement the functionality. In you case, the most natural approach is to create two stored procedures: one for saving class details, and one for saving subject details for class. This way, you create record with class data in primary table and subsequently record or records (in loop) with subject data in 'foreign' table. Each record in subject table must have class id set which will be its foreign key to record in primary class table.

    HTH

    Piotr

    ...and your only reply is slàinte mhath

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply