This topic is locked

write data to multiple tables simultaneously

9/24/2004 12:28:25 AM
ASPRunnerPro General questions
E
ekopelowitz author

Hello Sergei,
If I have three tables:

contacts

application1

application2
In all three tables I have the fields firstname and lastname
In contacts_add.asp user writes data for firstname and lastname
When user submits this data, I would like it to simultaneously write firstname and lastname to: application1 and application2.
Thank you for your help. Ezra

Sergey Kornilov admin 9/27/2004

Ezra,
if other tables have the same field names you can try something like this (see my changes in bold)

strFields = strFields & ")"

strValues = strValues & ")"
strSQL = strSQL & strFields & " values " & strValues
LogInfo(strSQL)

dbConnection.Execute strSQL

Call ReportError
LogInfo(strSQL)

dbConnection.Execute Replace(strSQL, "contacts", "application1")

Call ReportError

LogInfo(strSQL)

dbConnection.Execute Replace(strSQL, "contacts", "application2")

Call ReportError

message="<div class=message><<< Record was added >>></div>"

unique1 10/9/2004

I tried this and can't get it to work. I have 2 tables with ID as primary key in both tables which is an auto number. I dont know if that is why it isnt working. Both table are the exact same. One is for Regular and one is for Rush. I need the Rush table to also write the data to the Regular table. I'm also trying to get the Rush table to email when new record is added.
Any help is greatly appreciated.

Sergey Kornilov admin 10/11/2004

unique1,
please contact me directly at support@xlinesoft.com to find what is wrong with this code.