[thelist] Key ID of Record Just Created?

Jeff Howden jeff at jeffhowden.com
Wed Aug 24 13:01:10 CDT 2005


Keith,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Keith Gaughan
> 
> > Don'y know if it applies to ASP with MS/MY SQL but
> > might advise a transaction lock around the insert
> > and the select to ensure you retrieve the correct
> > ID.
> 
> With MySQL, I believe that the value of LAST_INSERT_ID()
> is tied to the connection, so as long as you still have
> the same connection you should have no problems.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

Provided you're not using an application server or abstraction layer that
uses connection pooling, in which case you may be using the same connection
for multiple queries.

 [>] Jeff Howden
     jeff at jeffhowden.com
     http://jeffhowden.com/



More information about the thelist mailing list