M
michel
Hi,
i have to insert values into two tables in one transaction.
The first table (base table) has a primary key (type 'integer') which is
incremented automatically with each insert.
The second table (detail table) contains a field (type 'integer') which must
get
the value of the primarty key of the last record in table 1.
So if the primary key value of the last record in table1 is e.g. 24, then
one field in table 2 must get that value.
I tried this but doesn't work: (nrec is always 0)
Dim nrec As Integer
insert into table1 (field1, ....) values( ....)
nrec = comd.ExecuteScalar()
comd.ExecuteNonQuery()
.....
insert into table2 (field1, ....) values(nrec ....)
comd.ExecuteNonQuery()
Thanks for help
Michel
i have to insert values into two tables in one transaction.
The first table (base table) has a primary key (type 'integer') which is
incremented automatically with each insert.
The second table (detail table) contains a field (type 'integer') which must
get
the value of the primarty key of the last record in table 1.
So if the primary key value of the last record in table1 is e.g. 24, then
one field in table 2 must get that value.
I tried this but doesn't work: (nrec is always 0)
Dim nrec As Integer
insert into table1 (field1, ....) values( ....)
nrec = comd.ExecuteScalar()
comd.ExecuteNonQuery()
.....
insert into table2 (field1, ....) values(nrec ....)
comd.ExecuteNonQuery()
Thanks for help
Michel