plook
IS-IT--Management
- Apr 1, 2000
- 33
Hi everybody !
I would like to ask your opinion !
I am posting a record in an SQL db (MS SQL 7) using CFINSERT. Which works fine. When posting the record, the SQL Server generates an ID to identify that record. I would like to return that ID immediately after the record is posted to use it in another CFINSERT. Since I don't think CFINSERT itself could return something I have a solution and would like to ask you guys what you think about it... First I open a CFTRANSACTION, then do the first CFINSERT,then send a query to find the biggest ID number,do the second CFINSERT using that ID returned from the query...then close the CFTRANSACTION...
so..
<CFTRANSACTION>
<CFINSERT #1>........
<CFQUERY ...>.....
<CFINSERT #2>.....
</CFTRANSACTION>
My concern is what would happen if 2,3 or 10 people post something using that Form at the same time? Is it dangerous that the CFQUERY between the 2 CFINSERTs return an ID posted by somebody else or CFTRANSACTION is supposed to "lock" the access until the completion of that transaction ?
Thanks for your feedback...
P.S. If somebody knows a better way to return that ID number it would be very appreciated to know it
)
Thanks
Dominic
I would like to ask your opinion !
I am posting a record in an SQL db (MS SQL 7) using CFINSERT. Which works fine. When posting the record, the SQL Server generates an ID to identify that record. I would like to return that ID immediately after the record is posted to use it in another CFINSERT. Since I don't think CFINSERT itself could return something I have a solution and would like to ask you guys what you think about it... First I open a CFTRANSACTION, then do the first CFINSERT,then send a query to find the biggest ID number,do the second CFINSERT using that ID returned from the query...then close the CFTRANSACTION...
so..
<CFTRANSACTION>
<CFINSERT #1>........
<CFQUERY ...>.....
<CFINSERT #2>.....
</CFTRANSACTION>
My concern is what would happen if 2,3 or 10 people post something using that Form at the same time? Is it dangerous that the CFQUERY between the 2 CFINSERTs return an ID posted by somebody else or CFTRANSACTION is supposed to "lock" the access until the completion of that transaction ?
Thanks for your feedback...
P.S. If somebody knows a better way to return that ID number it would be very appreciated to know it
Thanks
Dominic