I'm trying to read a dictionary file using VB.NET and output it into an Access DB. I'm a beginner with Access, so what I'm not quite sure about is how to enter data into multiple tables at once.
For example, I've got three tables (I've got 20, but simplifying,) called "Entry", "Keyword" and "Keyword_Priority". The Entry is the main table in the database, which records one entry in the dictionary. Each entry can have multiple Keywords, and each Keyword can have multiple Keyword_Priority elements. So Entry --< Keyword is one-to-many, and Keyword --< Keyword_Priority is one-to-many.
If I were to run a series of SQL statements to insert data into just these three tables, how would I go about it? Would I do:
1. Insert into Entry, then store the Entry.ID somehow
2. Insert into Keyword using the Entry.ID as a foreign key.
3. Insert into Keyword_Priority, using Keyword.ID as a foreign key.
Or would I do it the other way around ...
1. Insert into Keyword_Priority
2. Insert into Keyword
3. Insert into Entry
In other words, do I insert data from the top-down, or from the bottom-up?
-
Also, when inserting data into multiple tables, how would I store the Primary Key from each table to be used in the next SQL Insert statement?