Strange Locking Message

ta5
Member Posts: 1,164
Hi
We have a strange locking message in our customized code.
"The xy table cannot be locked or changed because it is already locked by the user with the id zz. Waint until the user is finished an then try again."
It is a message or an error, but not the common text shown in the status line at the bottom of the active window. The common text is "The xy table is locked by ab, press crtl+break to cancel..."
BTW: The text is located in fin.etx.
Anybody knows under what circumstances the message is shown (instead of the "normal" message?
Thanks in advance
Thomas
We have a strange locking message in our customized code.
"The xy table cannot be locked or changed because it is already locked by the user with the id zz. Waint until the user is finished an then try again."
It is a message or an error, but not the common text shown in the status line at the bottom of the active window. The common text is "The xy table is locked by ab, press crtl+break to cancel..."
BTW: The text is located in fin.etx.
Anybody knows under what circumstances the message is shown (instead of the "normal" message?
Thanks in advance
Thomas
0
Comments
-
This message will result when you set LOCKTABLE(FALSE).There are no bugs - only undocumented features.0
-
I believe that is the message that you get when a lock takes longer than the value in the lock timeout property.0
-
It is different for Native DB and MS SQL. MS SQL will not give you this info, because the wait is processed by MS SQL server and NAV client do not know about it. if you are using Native, NAV will show you this message...0
-
Hi
I can reproduce the message if the table is locked and another process issues the locktable(false) command.
It's a native db.
However, there are some open questions:
1) In our customized code there is NO locktable(false). Without locktable(false) the error is not reproducable in my dummy codeunits. So I still wonder why this error occurs in our customized codeunits.
2) I have 2 Codeunits
This is Codeunit-1table.init; table.pk := 'a'; sleep(10000); table.insert
While Codeunit-1 is idling, codeunit-2 issues table.locktable without an error. I guessed that there would be an error because transaction from Codeunit-1 is not finished then.
Hope somebody could bring some light in these misterious matter :?0 -
Locking is not done only as a result of the LOCKTABLE command. When you have process 1 modifying a record, and then process 2 modifying the same record, without updating that record with the modifications of process 1, then you get a locking error. It's database management, it's how your data is kept consistent.
You need to make your custom code aware of other processes, and either pass the record by reference or get the record again right before you modify it.0 -
Hi David
Thanks for your explanations.
But I still dont get the point why
a)... it's not possible to reproduce the originally posted error msg
and
b)...I don't get an error message with my 2 Codeunits configuration. I thought that while Codeunit-1 is sleeping, the transaction is still open and no other proces could lock that table.
Regards
Thomas0 -
the LOCKTABLE is not the time that it actually locks the table, it prepares the query to do it once you issue a MODIFY. In your codeunit 2 you could try modifying the record that you insert in codeunit 1, although I'm not sure if that will work.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions