save one master and multiple detail records on single button click

abuammar
 
on Feb 18, 2013 12:47 AM
2205 Views

as salaam alykum,

i am working on project  where i have one master table "PURCHASE_ORDER" with fields

order_no  as primary key

vendor_id

order_date

and i have a detail table called "PURCHASE_ORDER_DETIALS" with fields 

sno,order_no,item,qty,rate.

i am supposed to create a master detail form 

where i am supposed to accept an order from an vendor with multiple items.

i.e the form shoud accept one master record and multiple detail records and then either save all  of them or discard all of them(both master and multiple detail records).

its urgent plz

 

Download FREE API for Word, Excel and PDF in ASP.Net: Download
Mustafa
 
on Feb 18, 2013 01:27 AM
on Feb 18, 2013 01:30 AM

So you can write you query in transaction.

If you use transaction you can insert the data in both the tables. If there is an error while inserting the data in one of the above table than you can rollback the transaction. If data is inserted properly in both the tables than you can commit the transaction.

If you have further doubt than you will have to post your code as well as the sql query.