Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Data in one station appear in another station?
Message
From
05/11/1997 07:26:20
Shihchau Tai
Apic Systems Pte Ltd
Singapore, Singapore
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Title:
Data in one station appear in another station?
Miscellaneous
Thread ID:
00058304
Message ID:
00058304
Views:
79
I have this strange problem. When I am in network environment, my invoice details sometimes get clobber up with data from another station. Any idea what is the reason?

I am using NEWID() function in TASTRADE to generate my master table primary key (surrogated). In my grid, I set ALLOWADDNEW = .T. and in BeforeRowColumnChange, I replace foreign key with my master key whenever it is empty. The master-detail table is bound together in the data environment and in my gird, the LinkMaster, ChildOrder, RelationalExpr and RecordSource are all set properly. I am using private data session and optimistic buffering.

I went down to my user's office for a test today. It seems that while my master key didn't move (I test with a textbox on the form), my grid just suddently got fill up with data with another master key (I placed the foreign key field into one of the columns). I am not talking about a row but sometimes several rows of data. How can this happen? It seems to happen mostly when the other user saves his invoice.

I have my save button code below. There are certainly a lot of room for improvement in this code because it was my first VFP project. However, ignoring the bad implementation design, can someone see any problem with this code. Can someone help?


*!* In case the user wants running invoice number, invoice number is a regular key
lninvid=invmst.invid
IF thisformset.addmode=.T.
IF EMPTY(thisform.txtInvNo.value)
USE parm IN 0
SELECT parm
lcID=parm.InvNo
SET DECIMALS TO 0
REPLACE parm.InvNo WITH PADL(VAL(ALLTRIM(lcID))+1,6,'0')
thisform.txtInvNo.value=lcID
USE
ENDIF
ENDIF

*!* The first two statement should be in the customer class
select invmst
replace custid with thisform.custid_txt.value
if tableupdate(1,.F.,'invdet')=.T.
=tableupdate(0,.F.,'invmst')
endif

*!* StkHist is a transaction history file. Because of the large number of transactions,
*!* I have no choice but to save the records for faster access
IF thisformset.editmode=.T.
select stkhist

FLOCK() && added for testing purposes

delete all for docno="INV "+ALLTRIM(invmst.invno)
ENDIF

select invdet
scan for invid=thisform.txtinvid.value
INSERT INTO stkhist (docdate, docno, source, qty, currcode, ;
amtfor, amtsgd, exrate, stkcode) ;
VALUES (invmst.inv_date, "INV "+invmst.invno, ;
thisform.Custname_txt.value, -invdet.qty, invmst.currcode, ;
invdet.price, ROUND(invdet.price*invmst.exrate,3), invmst.exrate, ;
invdet.stkcode)
endscan
select stkhist
=tableupdate()
UNLOCK && added for testing purposes

select invmst
thisformset.form1.refresh
thisformset.addmode=.F.
thisformset.editmode=.F.
thisformset.form2.show
thisformset.form1.show
thisform.hide
Next
Reply
Map
View

Click here to load this message in the networking platform