Following situation:
I have a ASP.NET website for create VM's in an ESX environment. The user can select some settings and click on a button to create the VM.
The Click-Event of this button checks the values and write it into an MS SQL Server.
The table has an primary key (Integer, IDENTITY)
which I don't need to insert (because IDENTITY
).
But I need this primary key, because I redirect the user after the event to another page and this page needs the primary key for regular queries (send it with querystring).
Currently, I make a SELECT query direct after the INSERT INTO
query and take the last entry.
That works as long as only one user uses this page.
My question is:
Is it possible to recieve the IDENTITY
primary key directly from the INSERT INTO
query (like a return value from a function) ?