Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Setting Defaults and Paths on App Startup
Message
De
08/12/2005 10:10:49
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01076049
Message ID:
01076169
Vues:
21
I set my paths for database tables and free tables in the Dataenvironment event BeforeOpenTables() of forms. In this event, I have the following:
=SetDBCPath(thisform.Dataenvironment,gcDBCNetwkPath,"Catalog")
The parameter "gcDBCNetwkPath" is a global that defines the database path; the last parameter is the database name to change the path for. The UDF is as follows:
FUNCTION SetDBCPath
PARAMETER poForm,pcDBCPath,pcDBCName
LOCAL lcDBCName, lcFilePath, lnNumCursors, lnNdx
	lcDBCName  = FORCEEXT(pcDBCName,"DBC")
	lcFilePath = ADDBS(pcDBCPath) + lcDBCName
	lnNumCursors = AMEMBERS(lcProperties,poForm,2)
	FOR lnNdx=1 TO lnNumCursors
		IF UPPER(LEFT(lcProperties[lnNdx],6)) = "CURSOR"
			IF ATC(lcDBCName,poForm.&lcProperties[lnNdx]..database) > 0
				poForm.&lcProperties[lnNdx]..database = lcFilePath
			ENDIF
		ENDIF
	ENDFOR
RETURN
ENDFUNC
If you need to update for a free table, the following UDF is used:
FUNCTION SetDBFPath
LPARAMETERS poForm,pcDBFPath
LOCAL lnNumCursors, lnNdx, lcDBFName
LOCAL ARRAY lcProperties[1]
lnNumCursors = AMEMBERS(lcProperties,poForm,2)
FOR lnNdx=1 TO lnNumCursors
	IF UPPER(LEFT(lcProperties[lnNdx],6)) = "CURSOR"
		IF EMPTY(poForm.&lcProperties[lnNdx]..database)
			lcDBFName = JUSTFNAME(poForm.&lcProperties[lnNdx]..CursorSource)
			poForm.&lcProperties[lnNdx]..CursorSource = pcDBFPath + lcDBFName
		ENDIF
	ENDIF
ENDFOR
RETURN
ENDFUNC
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform