I recently had a strange thing happen in an ASP.Net application I wrote in VB. When each session starts, one of the first thing it does is create a record in a SQL table and captures its ID value, which is an identity field.
Two sessions were started very close to each other (within miliseconds). The first session needed to update a record in a SQL database using a stored procedure with the ID value. Prior to this update being processed, the second session had been started and received its ID value, which was one more then the first session. When the first session went to update the table, it used the ID value from the second session. Both sessions actually updated the same record, and the record that should have been updated by the first session was never updated.
Has anyone ever experienced this? Or can anyone tell me how this could have happened? Is there any way that one session can share data with another session unless a value has been stored globally?
I have no clue where to start looking. This application has over 10,000 lines of code (it is a credit card processing system). It has run flawlessly for multiple years until this.