|
-
Jan 25th, 2000, 03:17 AM
#1
I am performing an update SQL through an ADO command object on an Access database table. The commandtext is something like: UPDATE table SET field TO TRUE WHERE othertable!otherfield IS TRUE .... And it gets about 2/3 through the update when I get error: 'could not update; currently locked'. I run it again, and it locks at the same place.
Then I ran it as an update query in Access and it locks up again, only a little further on. I get the error: Could not update due to lock violations.
The database is on a remote server, but I am the only one using it. The default record locking is set to no locks, and the open mode is shared.
The update must be locking itself out, but is that possible? And what do I do about it?
-
Jan 25th, 2000, 04:21 AM
#2
Addicted Member
do you have relationships in your database with integrity enforcement and cascade update/delete? i have had experience that this created problems...
-
Jan 25th, 2000, 04:33 AM
#3
I do have integrity enforced, but not on the field being updated. The field being updated is a true/false flag set to whether it should go into a report. It is being set on a relationship to another table via primary = referential keys in a (sql) WHERE clause.
It seems like a simple update. That's what's got me buggered.
-
Jan 25th, 2000, 05:39 AM
#4
Member
-
Jan 25th, 2000, 06:25 AM
#5
Well the good news - your words - is that you are wrong, Gerald. But I don't think that's good, really. I tried the same update in Access in exclusive mode and it worked fine and quickly. I was stunned by how quickly. I'm running it again in shared mode, and it's gone off into orbit as it often does leaving me no clue as to what it is doing or if it is doing anything at all. But eventually I expect to get the same lock error.
When it has run off like this in the past I have had to break out of it with ctrl-alt-delete, which may be one reason why I'm having trouble now. But I when I let it run, it continues to late into the night when it is finally broken off at the server.
Is this peculiar to NT and/or Access? Are these two phenomena (ie., lock errors and lost in space) related?
-
Jan 25th, 2000, 08:50 AM
#6
Member
-
Jan 25th, 2000, 10:20 PM
#7
Here's the sql statement:
"UPDATE EFS_PROD SET
EFS_PROD.EFSPROD_REPORT = True
WHERE (((EFS_PROD.EFSPROD_CURRENT)= True ) AND ((EFS_PROD.PROD_CODE) = "
& rstRegistration!PROD_CODE & "));"
It is executed with a ado command:
WITH cmmUpdate
.ActiveConnection = adoConnection
.CommandText = strSql
.Execute
END WITH
If there is a problem, it is in the SQL or Access, because it locks in both VB in Access query. But, like I say, it didn't lock in exclusive mode but did in shared, even when there was nothing sharing it.
-
Jan 25th, 2000, 10:28 PM
#8
No, I take that back. It works in Access in exclusive mode, but not in VB in exclusive mode. Does this indicate anything?
-
Jan 26th, 2000, 06:20 AM
#9
Member
Your SQL UPDATE statement looks good and I really can't see anything wrong with it. How many records are affected by this update? Could there be some sort of maximum page/record lock threshold that is being exceeded on your server? Is it possible that another recordset/connection is locking your update command? Can you show the code that establishes your "adoConnection" and "rstRegistration" objects? See if they are locking out your update command.
Gerald
-
Jan 27th, 2000, 02:15 AM
#10
Lively Member
This might be of no help, but you don't have a form open that may be locking the table?
You've probably checked this, but it may be possible.
How about shifting gears into DAO and see if it works?
-
Jan 27th, 2000, 11:28 PM
#11
Sorry about the delay on the response, Gerald & John. We had a snow day yesterday. In answer to you John, there are several forms open - it is a MDI - but none have an active connection to these tables.
There are two recordsets already open in this procedure, both are adOpenForwardOnly and adLockReadOnly. The rstRegistration has this structure
sqlProducts = "SELECT BUY_REG.*, BUY_REG.REG_CODE
FROM REGISTRATION INNER JOIN BUY_REG
ON REGISTRATION.REG_CODE = BUY_REG.REG_CODE WHERE (((BUY_REG.REG_CODE)= " & rstReport!REG_CODE & "));"
With rstRegistration
If .State = adStateOpen Then
.Close
End If
.ActiveConnection = adoConnection
.CursorType = adOpenForwardOnly
.LockType = adLockReadOnly
.Open sqlProducts, Options:=adCmdText
End With
sqlReport = "SELECT BUYER.*, BUYER.BUY_CODE, REGISTRATION.REG_XDATE, REGISTRATION.REG_CODE, REGISTRATION.REG_NOTES FROM BUYER INNER JOIN (REPORT INNER JOIN REGISTRATION ON REPORT.REPORT_CODE = REGISTRATION.REPORT_CODE) ON BUYER.BUY_CODE = REGISTRATION.BUY_CODE Where (((REGISTRATION.REG_TERMINATED) = No) And ((REPORT.REPORT_CODE) = " & lngReportCode & ")) ORDER BY BUYER.BUY_COMPANY;"
With rstReport
If .State = adStateOpen Then
.Close
End If
.CursorType = adOpenForwardOnly
.LockType = adLockReadOnly
.ActiveConnection = adoConnection
.Open sqlReport, Options:=adCmdText
End With
My adoConnection connectstring is : "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strAppPath & "Database.mdb;Persist Security Info=False"
I will test John's idea of closing my other forms after I finish rebuilding my database as suggested by Gerald. I am now suspecting that it is a corrupted database, because I have an old copy in Access 97 which works ok - at least through this update. Time will tell.
I appreciate the mental exertion you guys have given. Thanks.
-
Jan 28th, 2000, 03:04 AM
#12
ok. Here's the deal. The update works off the server - that is, on a local disk. So its not the code and not the database. It's the server connection. How can I check the maximum page/record lock threshold you mentioned, Gerald? Can it be expanded?
-
Jan 28th, 2000, 05:37 AM
#13
Member
On a Netware server you would use the SET command to change any one of the following settings:
SET Maximum record locks per connection = ?
SET Maximum file locks per connection = ?
SET Maximum record locks = ?
SET Maximum file locks = ?
I don't have much experience with Windows NT server, so I can't help you there.
Gerald
-
Jan 30th, 2000, 09:55 PM
#14
We use NT with Netware. I'll ask the system admin for help. But, at least, you steared me in the right direction.
Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|