troubleshooting Question

ADO error Locking or Delay During Update

Avatar of Pemtium
Pemtium asked on
Databases
7 Comments1 Solution367 ViewsLast Modified:
I'm Using Foxpro 7.0

I open the same database 2 times!
but poiting to the same Record!

Jet 4.0 OLDB Provider

______________________________________________________________________________
objCmd1 = CreateObject("ADODB.connection")
OBJrs1  = CreateObject("ADODB.recordset")

objcmd1.ConnectionString="file name=data\DATA01.udl"
objcmd1.mode=3
objcmd1.open()
OBJrs1.OPEN( "SELECT * FROM JC_MAIN WHERE NUMBOX > 70000" , OBJCMD1 , 2 , 3)


objCmd2 = CreateObject("ADODB.connection")
OBJrs2  = CreateObject("ADODB.recordset")

objcmd2.ConnectionString="file name=data\DATA01.udl"
objcmd2.mode=3
objcmd2.open()
OBJrs2.OPEN( "SELECT * FROM JC_MAIN WHERE NUMBOX > 70000" , OBJCMD2 , 2 , 3)
_________________________________________________________________________________



   OBJRS1.FIELDS("CONTROLACD") = OBJRS1.FIELDS("CONTROLACD").VALUE + 1
   OBJRS1.UPDATE

*

   OBJRS2.FIELDS("TOTOLDMSG") = OBJRS2.FIELDS("TOTOLDMSG").VALUE + 1
   OBJRS2.UPDATE

(same records)

on the 2nd Update i got and error:
The Microsoft database engine stopped the process cause you and another user are trying to change the same
data at the same time.  (WHY?)

by the way, i dont care if the 2nd overwrite the data that the previous update did! i just wnat to avoid
the error. If there a way to know in advanced if the record is locked  or in a Update Process

Another Note: if i Insert a timeout beetween each update of like 5 seconds i dont get any error

ASKER CERTIFIED SOLUTION
Computer101

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros