suppose we have three tables in the Database:
- tbl_companymaster(company_id(PK),company_name)
- tbl_papermaster(paper_id(PK),paper_name,rate)
- tbl_rate(rate_id(PK),company_id(FK ),paper_id(FK),rate)
we have to fire a query of insert on the clicking of a button in asp.net with c# language.
we have to insert the company_id (from tbl_companymaster),paper_id(from tbl_papermaster),rate(sfrom tbl_papermaster) into tbl_rate Example:
tbl_companymaster:
company_id company_name
-----------------------------------
1 lalit and company
-------------------------------------
2 deepesah and co.
-----------------------------------
3 RP & Co.
-------------------------------------
tbl_papermaster:
paper_id paper_name rate
-------------------------------------------------
1 plain 400
------------------------------------------------
2 carbon 300
-------------------------------------------------
3 butter 500
tbl_rate:
rate-id company_id paper_id rate
---------------------------------------------------------------
1 1 1 400
--------------------------------------------------------------------
2 1 2 300
-----------------------------------------------------------------------
3 1 3 500
------------------------------------------------------------------------
4 2 1 400
-----------------------------------------------------------------------
5 2 2 300
---------------------------------------------------------------------
6 2 3 500
------------------------------------------------------------------------
Please help me with the suitable code.I m in a great trouble with this code.
Thanks in advance.