Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
=SetDBCPath(thisform.Dataenvironment, _VFP.DataPath, "<<YourDBCName>>")
************************************************************************************************
*
* Routine for setting the database directory location for the form
*
FUNCTION SetDBCPath
LPARAMETERS toFormDE, tcDBCPath, tcDBCName
LOCAL lcDBCName, lcFilePath, lnNumCursors, lnNdx
LOCAL ARRAY laProperties[1]
lcDBCName = FORCEEXT(tcDBCName, "DBC")
lcFilePath = ADDBS(tcDBCPath) + lcDBCName
lnNumCursors = AMEMBERS(laProperties, toFormDE, 2)
FOR lnNdx=1 TO lnNumCursors
IF UPPER(LEFT(laProperties[lnNdx], 6)) = "CURSOR"
IF ATC(lcDBCName, toFormDE.&laProperties[lnNdx]..Database) > 0
toFormDE.&laProperties[lnNdx]..Database = lcFilePath
ENDIF
ENDIF
ENDFOR
ENDFUNC
*initialiszation of dbc structure and directories
Close Tables All
Close Databases All
Cd (Getenv("temp"))
Try
Cd dbpathsdemo
Erase dbp*.*
Cd Tables
Erase dbp*.*
Cd ..
RmDir Tables
Cd ..
RmDir dbpathsdemo
Catch
*
Endtry
Mkdir dbpathsdemo
Mkdir dbpathsdemo\Tables
Cd dbpathsdemo
Create Database dbp.Dbc
Create Table dbptable1.Dbf Name tableone (id1 int)
Create Table dbptable2.Dbf (id2 int)
Close Tables all
lcDBC = Dbc()
Close Databases all
* Application data handling
Open Database (Addbs(Getenv("temp"))+"dbpathsdemo\dbp.dbc")
Set Database To dbp
* Intentionally set defetula directory elsewhere
Cd C:* Intentionally set no paths
Set Path To
* Works with long table names
Use tableone in 0
Select tableone
? Alias(), Dbf()
* works with file names
Use dbptable2 In 0
Select dbptable2
? Alias(), Dbf()
My data are on a local NAS and are accessed over a Gb wired LAN, the shared folders on the NAS are mapped as local drives - for over 10 years this has been working fine for me
Set Path To []
? SET('path')
*** Go ahead and set the path
If Version(2) # 0
*** We are in Development Mode
*** Set up Project search path
m.lcPath = Home() + ';' + Fullpath( Curdir() ) + [Class; Data; Forms; Images ; Menu; Progs ; Reports; ReportingFiles]
Else
*** We are in Production Mode
*** Set up application search paths
m.lcPath = Fullpath( Curdir() ) + [ ;Reports ; ReportingFiles]
Endif
** to set my dataenvironment:
** Get value from projectsini file:
lcDataDir = goInimgr.GetValue( 'Datadirectory','DIRECTORY','PROJECTS.INI')
lcPath = Set('PATH')
lcPath = m.lcPath+ [;] +m.lcDataDir
If Version(2) # 2
[indent][/indent]? lcDataDir ** for quick reference in development mode, echo the datadir on my screen
Endif
Set Path To []
Set Path To (m.lcPath)