Re: How do you get the @@identity for the record just inserted?
Posted by: Timothy Graupmann
Date: January 23, 2005 03:38PM

This command executes but it doesn't like the parameter "@@IDENTITY". so I'll just have to grab index 0 and hope that works.

myCommand = myConnection.CreateCommand();
myCommand.CommandText = "SELECT @@IDENTITY";
IDataReader reader = myCommand.ExecuteReader();
if (reader.Read())
{
newMeshNode.MeshNodeId = (UInt32)reader["@@IDENTIY"];
if(newMeshNode.MeshNodeId == 0)
throw new Exception("Invalid MeshNodeId was assigned.");
}

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.