I am having trouble inserting data into multiple tables. Basically i have
three tables in my database, namely author1,writes1 and Journal1. Now
since there is a many to many relationship between author and journal, i
created a table in between called Writes, to create a one to many
relationships. This Writes table will store the Primary keys as foreign
keys for both the tables. Now i can insert data into both of the tables
but i dont know how to insert values of primary keys into the writes
table.And i would like to say that the primary key for both the tables is
set to AutoNumber field.
Here is part of my code:
<%
Dim rsUsers,rsUsers1
Set rsUsers = Server.CreateObject("ADODB.Recordset")
rsUsers.Open "Article1",
strConnect,adOpenKeyset,adLockOptimistic,adCmdTable
rsUsers.AddNew
rsUsers("Title") = Request.Form("Title")
rsUsers("Year") = Request.Form("Year")
rsUsers("Month") = Request.Form("Month")
rsUsers("Volume") = Request.Form("Volume")
rsUsers("Number") = Request.Form("Number")
rsUsers("FPage") = Request.Form("FPage")
rsUsers("LPage") = Request.Form("LPage")
rsUsers("Journal") = Request.Form("Journal")
Set rsUsers1 = Server.CreateObject("ADODB.Recordset")
rsUsers1.Open "Author1",
strConnect,adOpenKeyset,adLockOptimistic,adCmdTable
rsUsers1.AddNew
rsUsers1("FName") = Request.Form("FName")
rsUsers1("LName") = Request.Form("LName")
rsUsers.Update
rsUsers.Close
rsUsers1.Update
rsUsers1.Close
%>