Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP seems to get data from a table without opening it!
Message
From
06/05/2008 03:56:36
 
 
To
05/05/2008 15:42:45
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01315181
Message ID:
01315256
Views:
29
Hi Alejandro.

I assume that when you save llCloseDBF is .F. you mean it's .T. and it's the USED() that is returning .F.
Used doesn't tell you if a table is open, but rather tells you if an alias is in use. SQL Select uses the name in the From clause as a a table name, not an alias, so in this case, if you had the table open in another work area with a different alias then expect to get what you have happening there. llCloseDBF is loaded with .T. because there is no work area with an alias that matches the table name you are using, the Select uses the open table to select it's data, and then you get the error as there is still no work area with an alias matching your table name.

Might I suggest that you either change the check to -
If llCloseDBF and Used(tcDataDict)
or you change the use line line to -
Use in (Select(tcDataDict))

Ian Simcock.


>I found an unexpected situation:
>
>A method has the following code:
>
>LPARAMETERS tcDataDict && Has value of 'DD_Fac_Int'
>LOCAL llCloseDBF,laFields[1,4]
>llCloseDBF = !USED(tcDataDict)
>SELECT _fieldname,_fieldtype,_fieldlen,_field_dec FROM (tcDataDict) INTO ARRAY laFields
>IF llCloseDBF
> USE IN (tcDataDict)
>ENDIF
>...
>RETURN
>
>The method is called twice. The first time it works as I expected, namely the (tcDataDict) table is closed after the SELECT.
>
>During the second call llCloseDBF takes on .F. before running the SELECT, and the laFields array is filled as expected, but the (tcDataDict) table is NOT opened, so USE IN (tcDataDict) gives error. Apparently VFP finds the data (perhaps from cache) without opening the (tcTableDict) table. I did not expect this behavior. Should I have expected it?
>
>TIA,
>
>Alex
Previous
Reply
Map
View

Click here to load this message in the networking platform