Groups | Blog | Home
all groups > dotnet ado.net > july 2007 >

dotnet ado.net : How to get the last created or modified dataset


thalion77 NO[at]SPAM graffiti.net
7/25/2007 12:38:23 AM
Hello,

is there a possibility to get the ID of the last created or modified
dataset of a table via ADO.NET? Is there a database independent way?

In SQL Server you can call the scope_identity() function, but this
won't work in Oracle, MySQL, Access a.s.o.

Thanks in advance,
Norbert
Kerry Moorman
7/25/2007 8:34:03 AM
Norbert,

If you are trying to retrieve the database-generated primary key value for a
newly inserted row, there is no database-independent way to do that, as far
as I know.

In SQL Server you can select scope_identity, in Access you can select
@@identity, in Oracle you need to query the appropriate sequence object, etc.

Kerry Moorman


[quoted text, click to view]
AddThis Social Bookmark Button