Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I change dbc path in form
Message
From
10/10/2006 11:52:03
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
10/10/2006 10:40:12
Arjun Bagojikop
Dynamic Super Software
Sangli, India
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01160849
Message ID:
01160893
Views:
44
>HI Friends
>set database to c:\data1\data
>
>when i design the form i have select the table from dbc into datanvironment
>before execute the form i want to change dbc path
>
>please help how can i change the path
>
>i have tried
>set database to c:\data2\data
>but run time form read data from c:\data1\data

This is what I do:
*UpdateDE.prg
Lparameters toDE,tcAppDb,tcPath
Do setups && contains general "set" like set century on, exact off, ...
Local Array aDEMembers[1]
Local lnMembers,ix,lcMembers
if !(Type('oApp')='O' and !IsNull(oApp)) && in case testing with customer's data
  public oApp
  tcAppDb = iif(empty(m.tcAppDb),"mydefault.dbc", m.tcAppDb)
  tcPath  = iif(empty(m.tcPath), "myDefaultDataFolder",m.tcPath)
  oApp = CreateObject('myApp',m.tcAppDb,m.tcPath)
endif
lnMembers = Amembers(aDEMembers,toDE,2)
For ix=1 To m.lnMembers
	With Evaluate('toDe.'+aDEMembers[m.ix])
		If Lower(.BaseClass) == 'cursor'
			If Atc(oApp.cAppDBC,.Database) > 0
				.Database = Addbs(oApp.cAppDataPath)+oApp.cAppDBC
			Else
				.CursorSource = Addbs(oApp.cAppDataPath)+Justfname(.CursorSource)
			Endif
		Endif
	Endwith
Endfor

Define Class myApp As Custom
	cAppDBC = ''
	cAppDataPath=''
	cCurPath = ''
	Procedure Init(tcAppDb,tcPath)
	  This.cCurPath = Set('path')
	  This.cAppDataPath = m.tcPath
          this.cAppDbc = (m.tcAppDb)
	  set Path To (this.cAppDataPath+';'+This.cCurPath)
	Endproc
	Procedure Destroy
	  Set Path To (This.cCurPath)
	Endproc
Enddefine

* And I have this in DE.BeforeOpenTables
UpdateDe(this)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform