Lock Table

redStripe
Member Posts: 83
Hello,
I would like to lock a specific table during the runtime of a function.
If there is set a flag, this lock should be reset.
I tried 2 ways:
1. Locktable
Loop that check if the parameter ist set
if yes, reset the lock
2. I made a little form and in the onTimer Trigger i write a dummy record
to the table and after that I delete it. So Navision should lock this
table by itself.
To test both ways I tried so write new data to the locked table - and it
worked!?! But why??? I locked that table ... why I can write to it?
It should be permitted.
regards,
redStripe
I would like to lock a specific table during the runtime of a function.
If there is set a flag, this lock should be reset.
I tried 2 ways:
1. Locktable
Loop that check if the parameter ist set
if yes, reset the lock
2. I made a little form and in the onTimer Trigger i write a dummy record
to the table and after that I delete it. So Navision should lock this
table by itself.
To test both ways I tried so write new data to the locked table - and it
worked!?! But why??? I locked that table ... why I can write to it?
It should be permitted.
regards,
redStripe
0
Comments
-
The form with timer and the lock were running in the same client?0
-
I tried both.
I can write data to the table in the client where the form runs, but also
from an other client I can write to the table.0 -
Which database are you using (Native or SQL)?There are no bugs - only undocumented features.0
-
sorry I forgot to say ... it is a Native DB0
-
How are you calling the LockTable? Remember that the lock will only last to the end of the current transaction. Put something like a CONFIRM statement that will hold the transaction open.There are no bugs - only undocumented features.0
-
I do it this way ...
//blocking the table recTable.Locktable(true); repeat //stop and wait until parameter = true //unblocking the table recTable.reset;
as long as the parameter = false the the table should be locked.
But I can insert a new row without any problem ... why???0 -
Important : Navision buffers its writes to the DB on the client. Once the buffer is full or an immediate response is required from the server, it is send to the DB.
If you are debugging, this buffering does not happen.
So the LOCKTABLE itself does not always lock the table immediately. If you want to do that, you should put a "IF FINDFIRST THEN ;" [or FIND('-') ] after it.
This last piece of code sends the "LOCKTABLE"-request to the DB and the table will be locked.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
i put a find('-') now after the locktable ... but I get the same result nothing
changed
Are there maybe other ways to block a table?0 -
Try this:
recTheTable.LOCKTABLE; IF recTheTable.FIND('-') THEN ; IF CONFIRM('The table should be locked now',FALSE) THEN ; COMMIT; // a RESET doesn't free the table. A COMMIT does.
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!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