Forums - C# Corner

Forum guidelines
Neeraj Kumar

Neeraj Kumar

  • 199
  • 8.1k
  • 918.6k

How to Insert Multiple table data at same time?

May 13 2016 12:03 AM
I hace 4 table in my database
1. Publisher Table
   Attributes : ID (primary key,autoincrement) ,Name,City,Address,State
2 Author Table
   Attributes : ID (primary key,autoincrement),Firstname,Lastname
3 Book Table
   Attributes: ID(primary key,autoincrement),title,PublisherID (Foreign Key with Publisher ID)
 4.Book_Author_MAP Table
   Attributes: ID(primary key,autoincrement),BookID,AuthorID(Foreign Key with Author ID)
In all tables ID is only unique no one data is unique.
Now I have single form in that takes input  Publisher-> Name,City,Address,State,
                                                                        Authors -> Firstname,Lastname,
                                                                        Book -> Title
All the field will show on browser But when I submit the form I want to store all value in all table. But when firstly I save Publiser values but how can i find ID of publisher at that time because No one data in unique without ID and Book table ID attributes required publisher ID that time.How can I fetch ID of publisher.


Answers (2)


Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now