Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I change to datasource for my View
Message
From
07/11/2000 12:11:12
 
 
To
07/11/2000 11:46:47
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00438826
Message ID:
00438849
Views:
11
>I have a view which is looking at a free Fox 2.6 table.
>This view works fine but I want to change the location of where on the network it finds its datasource on the fly.
>
>Assuming this was done with either CURSORSETPROP() or DBSETPROP()
>I decided to experiment with them, starting by looking at their opposite numbers.....CURSORGETPROP() and DBGETPROP(), in order to try and return property information about my view.
>

Right. The view doesn't really care where it's
For tables contained in another database, all that matters is that the table's database is open, e.g.,

OPEN DATA //myserver/somewhere/tabledata
OPEN DATA d:\mylocal\data\viewdata
CREATE SQL VIEW myView AS SELECT * FROM tabledata!mytable


Now, you can use this view against any "tabledata" database, as long as it's open and the base table has the same structure as the original. e.g.,

OPEN DATA //myserver2/somewhere_else/tabledata
OPEN DATA d:\mylocal\data\viewdata
USE myView


For free tables, the view looks along the path.
So if you change the SET PATH on the fly - or USE the desired free table before using the view, it should work. e.g.,
With a free table called myfree, let's say there are 2 directories where it exists with the same structure. One has 30 records, the other has 50.
The view is myfreeview, and simply selects all records.
Neither directory is in the current SET PATH.
OPEN DATA d:\mylocal\data\viewdata
lcOldPath = SET("PATH")
lcNewPath = lcOldPath + ", //server/directory1" && with the 30 records
SET PATH TO &lcNewPath
USE myfreeview
? RECCOUNT() && returns 30
USE IN myfree
lcNewPath = lcOldPath + ", //server/directory2" && with the 50 records
SET PATH TO &lcNewPath
REQUERY()
? RECCOUNT() && returns 50
Insanity: Doing the same thing over and over and expecting different results.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform