using LAST_INSERT_ID without being provider-specific
Posted: Tue 23 Aug 2005 01:34
Hi,
I'm considering purchasing unidirect.net but its usefulness will be limited if I can't get the last inserted primary key back in a generic way. Obviously the query for MySQL is SELECT LAST_INSERT_ID() and for SqlServer it's SELECT @@IDENTITY, but I don't want my application code to even need to check which provider it's using.
Any ideas?
Cheers,
Luke
I'm considering purchasing unidirect.net but its usefulness will be limited if I can't get the last inserted primary key back in a generic way. Obviously the query for MySQL is SELECT LAST_INSERT_ID() and for SqlServer it's SELECT @@IDENTITY, but I don't want my application code to even need to check which provider it's using.
Any ideas?
Cheers,
Luke