Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select from unintended table
Message
From
03/04/2003 04:40:27
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00773439
Message ID:
00773446
Views:
23
>Hi All,
>
>I've come across an annoying behaviour which seems strange. With two identical databases (content, names etc) in different paths:
>
>
>OPEN DATABASE myPathA\myDBC
>OPEN DATABASE myPathB\myDBC
>SET DATABASE TO myPathA\myDBC
>USE myView   && View defined in myPathA\DBC "Select * from myDBC!myTable"
>SELECT myTable    && Underlying table opened by View
>? DBF()    && = myPathB\myDBC
>
>
>So VFP has selected from the table in the last opened database rather than the current database ! I know that hardcoding the path into the view definition would avoid the problem but it's not an option in my current situation and I've yet to find an alternative solution.
>
>Any suggestions (except an ER)?
>
>Regards,
>Viv

Viv,

Confirmed.

Workaround just tested using the fullpath of the database
OPEN DATABASE myPathA\myDBC
OPEN DATABASE myPathB\myDBC

=adatabase(pp)
set data to (pp[2,2]) && you will need to verify it is in p[2,2], or loop through pp[] to find the actual row
&& or maybe : set data to ('.\MypathA\Mydbc.dbc')
USE myView
select MyTable
?dbf() && something like C:\project\MypathA\myDBF.DBC
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform