My question/problem revolves around the wonderful optimistic concurrency issue when running scripts on multiple machines pulling from the same db. I think this is commonly referred to as the "race condition." I am using the connection properties below and when I leverage my script on multiple machines I often get the o.c. error. I am calling my sql statement, grabbing the unique ID of the record, and closing the recordset. Once I have performed my actions I am opening the recordset again by calling back the ID I previously retrieved. After these steps I am once again calling my original sql statement grabbing the next available record. Its at this time when my script errors for o.c.. When I call the record and grab the ID I am setting a field to Open which should exclude that record from future searches. The problem is it is not always excluded as the SQL statements are occuring at the same time on different machines. Any ideas on how to prevent this from occuring in the future?
Set oConn = CreateObject("ADODB.Connection")
SQL = "SELECT * FROM [Main] WHERE [Stamp] IS NULL AND [Status] IS NULL"
oRs.LockType = adLockOptimistic
oRs.open SQL, oConn
I specialize in automation. I am fairly new to QTP.