[thelist] Key ID of Record Just Created?

Keith Gaughan keith at digital-crew.com
Wed Aug 24 09:10:56 CDT 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chris Hayes wrote:

>>> DIM valDocID as Integer = SELECT @@IDENTITY
>>
>> I don't know anything about .NET syntax, but basically yes, you will
>> have to
>> run that SELECT query, and assign the results to a variable
> 
> 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.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDDH/wmSWF0pzlQ04RAm2pAJ0aWdp0fhlEXsbppqKzL0E+WyUZVwCgnkY7
XrdIpzjh2BrdBtXdzXRTj5Y=
=g4No
-----END PGP SIGNATURE-----


More information about the thelist mailing list