TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Rajneesh Chaubey
NA
2.9k
235k
How to insert multiple records in sql?
Feb 13 2018 9:29 AM
I have 3 tables Client, Product and Transaction.
Client table has ClientID is (identity)
ClientID Clientname Email Mobile
Product has ProductID(Identity)
ProdID ClientID Prodname
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.
Reply
Answers (
8
)
How to provide different arguments to an object factory?
How to highlight specific date/dates in MonthCalendar?