Now it seem run, I can open and save customer.dbf
I made
USE &(oApp():cDbfPath+cDbf+".dbf") ;
INDEX &(oApp():cDbfPath+cDbf+".cdx") ;
ALIAS &(cAlias) NEW SHARE
and I change giving to oApp():cDbfPath all the exact directory
::cExePath := cFilePath(GetModuleFileName(GetInstance())) //+ "\"
oApp:cYearPath := "2018"
oApp:cDbfPath := ::cExePath+oApp:cYearPath+"\dbf"+"\"
But I'm not convinced yet,
the program never stops even when it has to delete a record that another computer is editing,
I have deleted the number 1 from the customer.dbf file but this record was in edit mode on another computer
how is this possible?
obviously in the save record I used
- Code: Select all Expand view
- If !Occupated("CU")
Replace CU->Id with nId
Replace CU->First with cFirst
Replace CU->Last with cLast
Replace CU->street with cstreet
Replace CU->City with cCity
Replace CU->State with cState
Replace CU->Zip with nZip
Replace CU->Hiredate with dHiredate
Replace CU->Married with lMarried
Replace CU->Age with nAge
Replace CU->Salary with nSalary
CU->(DbCommit())
CU->(Dbunlock())
Endif
the function Occupated(cAlias) with Rlock
- Code: Select all Expand view
- FUNCTION Occupated(cAlias)
LOCAL lRet:=.F., Sigue:=5
DEFAULT cAlias:=Alias()
DO WHILE Sigue>0
IF (cAlias)->(RLock())
Sigue:=0
ELSE
INKEY(0.5)
Sigue:=Sigue-0.5
IF Sigue<=0 .AND.;
MsgYesNo("!Registration occupied by another user!"+CRLF+ ;
" Please wait... ", "Conferma...")
Sigue:=3
ELSE
lRet:=.T.
ENDIF
ENDIF
ENDDO
RETURN (lRet)
I'm not convinced that this can work