Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Table Updates
Message
From
24/07/2000 10:51:54
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00396150
Message ID:
00396155
Views:
11
>>There is a table called po_no which is used to get the next po #. When the user chooses to add a po, the po # is the current value in po_no.next_no. Then the table value is incremented by one (value of next PO). This works just fine when I have one instance of the program running. When I try to run two instances, the table value has not been update when I try to add the second po (they both try to use the same #). The following code is used:
>>
>> SELECT po_no
>> temp_pono = po_no.next_no
>> THISFORM.txtPO_no.VALUE = temp_pono
>> REPLACE po_no.next_no WITH (temp_pono+1)
>>
>>
>>What should I do to force the table update?
>
>Wrap the operation in an RLOCK()
>
>SELECT po_no
>IF RLOCK()
> temp_pono = po_no.next_no
> THISFORM.txtPO_no.VALUE = temp_pono
> REPLACE po_no.next_no WITH (temp_pono+1)
>ENDIF
>UNLOCK
>
>If you're using any buffering, you'll need to issue a TABLEUPDATE() to force the data in the buffer to update the table.

You may need to repeatedly test RLOCK() until it succeeds
SELECT po_no
DO WHILE ! RLOCK()
ENDDO
temp_pono = po_no.next_no
THISFORM.txtPO_no.VALUE = temp_pono
REPLACE po_no.next_no WITH (temp_pono+1)
UNLOCK
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform