
I have 3 tables Client, Product and Transaction.
Client table has ClientID is (identity)
- ClientID Clientname Email Mobile
Product has ProductID(Identity)
Transact table has TransactID(Identity)
- TransactID ProdID ClientID ParamID
ParamID is the value of those chechboxes.
I want to insert multiple product against single client. Let say there is another button to insert Product(Before Final Insert). On that button we store multiple data on button click in DataTable. It will hold data till we finnaly submit the form. For every Product there can multiple selection of checkbox.
Now final insert will be like that Client details will go to the client tables, and for product say
he has inserted two product:p1 and p2 it will goes to product and take particular client id. Like this:-
- ProdID ClientID Prodnam
- 1 1 p1
- 2 1 p2
So 2 rows will be affected.
And In transaction table (the most confusing one) multiple rows will be affected such that:
- TransactID ProdID ClientID ParamID
- 1 1 1 2
- 2 1 1 3
- 3 2 1 1
- 4 2 1 4
ParamID indicates that for value of particular checkbox against that product.
So there is multiple rows to be affected in sql server. How do I handle the same in C# codebehind?
I am confused. Please suggest me. Any help would be greatly appreciated. Thank you.