In my project of converting from 16 bit to FWH, i need to change all my Ntx and partial COMIX files to CDX FWH.
I have the folowing code for opening files in FW16 :
Is this code still a good code, (change the COMIX to CDX...) or should I find a better one that uses more of FWH Power.
Maybe someone can share his code to open in network situation ?
At this point, I want to convert strait from 16 to 32. Later I could change to Objects, or other options.
Thanks.
- Code: Select all Expand view RUN
- FUNCTION NETOPEN( cFile, lMode, cAlias, nSeconds, lNewArea,cDriver, lReadOnly )
local nWaitTime, lContinue := .t., lSuccess := .f., TSEL := 0
DEFAULT lMode := .T. // shared mode
DEFAULT nSeconds := 3
DEFAULT cAlias := cFile
DEFAULT lNewArea := .t.
DEFAULT cDriver := "COMIX"
//DEFAULT cDriver := "DBFNTX"
DEFAULT lReadOnly := .f.
nWaitTime := nSeconds
// bestand het bestand
IF ! FILE( cFile + ".DBF" )
Exit("Bestand " + CFILE + ".DBF is afwezig")
ENDIF
// verify driver is valid
if ascan( RddList(), cDriver ) == 0
MSGSTOP("Driver " + Cdriver + " afwezig")
Exit()
endif
//
// Indien reeds geopend, alles ok, select waar
//
IF SELECT(cAlias) # 0
MsgInfo("File was reeds geopend")
TSEL := SELECT(cAlias)
SELECT(TSEL)
lContinue := .t.
lNewArea := .f.
ENDIF
// while continuing to attempt open
Do while lContinue // while .not. timed-out
while nSeconds > 0 .and. lContinue
//dbUseArea( lNewArea, cDriver, cFile, cAlias, ( .not. lMode ), lReadOnly )
dbUseArea( lNewArea, cDriver, cFile, cAlias, lMode, lReadOnly )
// check for success/failure
IF neterr()
nSeconds--
lSuccess := .F.
else
// open successful
nSeconds := 0
lSuccess := .t.
lContinue := .f.
ENDIF
ENDDO
IF ! lSuccess
nSeconds := nWaitTime
MSGSTOP("Bestand " + CFILE+" Alias : "+cAlias + " is geopend door een andere gebruiker" + CRLF + CRLF + "Gelieve even te wachten")
lSuccess := .F.
lContinue := .T.
lNewArea := .T.
ENDIF
ENDDO
return lSuccess