Is it possible to submit data into a SQL database, wait for that to finish, and then return the ID g

Posted by user322478 on Stack Overflow See other posts from Stack Overflow or by user322478
Published on 2010-04-22T18:30:21Z Indexed on 2010/04/22 18:33 UTC
Read the original article Hit count: 106

Filed under:
|
|
|

I have an ASP form that needs to submit data to two different systems. First the data needs to go into an MS SQL database, which will get an ID. I then need to submit all that form data to an external system, along with that ID.

Pretty much everything in the code works just fine, the data goes into the database, and the data will go to the external system. The problem is I am not getting my ID back from SQL when I execute that query. I am under the impression this is happening because of how fast everything occurs in the code. The database is adding it's row at the same time my post page runs it's query to get the ID back, I think.

I need to know of a way to wait until SQL finished the insert or wait for a specific amount of time maybe. I already tried using the hacks to "sleep" with ASP, that did not help.

I am sure I could accomplish this in .Net, my background is more .Net than ASP, but this is what I have to work with on my current project.

Any ideas?

© Stack Overflow or respective owner

Related posts about asp-classic

Related posts about sql