Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Update problem
Message
From
17/05/2011 02:27:16
Yahia Aboudalal
International Computer Center
Tripoli, Lebanon
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Update problem
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01510839
Message ID:
01510839
Views:
114
Hi experts
I have a problem which I could not resolve.A routine make a voucher in table (hist_a) for a patient whose code is (mcust),then after adding the record in (hist_a),the patient record is updated with voucher no. of the added voucher.All this is included in a transaction,means either both operations succeeds or fails.What happens is that sometimes in an unpredictable manner a voucher is added but the patients record is not updated with the voucher no. and stays empty.
Please check the following code :



Select CUSTOMER && patients
SET ORDER TO c_code
Seek mcust
If !Found()
Messagebox("PROCESS ERROR: CANNOT COMPLETE THE LINK,;
exit the program and try again!", 16, "Link error")
Return
Endif
try
Begin Transaction
Select HIST_A && vouchers
Do While !Rlock('0','HIST_A' )
Enddo
Go Bott
mvoucher=Iif(v_code>0,v_code+1,2)
Append Blank In HIST_A
Repl Date With ma_date,v_code With mvoucher,v_ref With mcust,v_ref1 With mcust In HIST_A
*this always succeed
Unlock
=Seek(mcust,'customer','c_code') && sur to succeed since it is previously tested.
Repl CUSTOMER.v_code With mvoucher In CUSTOMER && this replace sometimes fail
End Transaction
Catch
rollback
Messagebox("PROCESS ERROR: CANNOT COMPLETE THE LINK,;
exit the program and try again!", 16, "Link error")
Endtry



Any suggestions will be appreciated.
Thanks in advance.
Yahia
Next
Reply
Map
View

Click here to load this message in the networking platform