Hi:
I want to insert into a field in a table the value of the primary key of other table.
This is a 1 to N relationship and I need to make the INSERT INTO of both tables. I have been looking in other threads, and I have found the next sentence:
Set recordset = connection.Execute("select @@IDENTITY"
the autonumber = recs.Fields(0)
First of all is that I don´t know if I can use it because some people can be accessing the same page and inserting data at the same time (I mean if I can get the @@IDENTITY value of other customer instead of the one I want), and I dont know if the system itslef can block this from happening.
I am using SQL SERVER 2000.
The INSERT INTO should be like this:
...
HTML
...
<%
...
x = INSERT INTO event (field1,field2,field3) VALUES (1,2,3);
execute x
y = INSERT INTO date(id_event,field4,field5,field6) VALUES ("Here a put the value of the ID from the first INSERT",4,5,6)
execute y
...
%>
...
HTML
...
Thanks in advance,
moroeh
I want to insert into a field in a table the value of the primary key of other table.
This is a 1 to N relationship and I need to make the INSERT INTO of both tables. I have been looking in other threads, and I have found the next sentence:
Set recordset = connection.Execute("select @@IDENTITY"
the autonumber = recs.Fields(0)
First of all is that I don´t know if I can use it because some people can be accessing the same page and inserting data at the same time (I mean if I can get the @@IDENTITY value of other customer instead of the one I want), and I dont know if the system itslef can block this from happening.
I am using SQL SERVER 2000.
The INSERT INTO should be like this:
...
HTML
...
<%
...
x = INSERT INTO event (field1,field2,field3) VALUES (1,2,3);
execute x
y = INSERT INTO date(id_event,field4,field5,field6) VALUES ("Here a put the value of the ID from the first INSERT",4,5,6)
execute y
...
%>
...
HTML
...
Thanks in advance,
moroeh