Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
View simple problem
Message
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00439246
Message ID:
00439261
Views:
20
>>Hi everybody,
>>
>>In my code (currently it's a program, lately I may make it to be a form's method) I open a view by use vAllStatConfigs in 0 nodata alias WorkConfig. Then I assign view parameter and requery(). In Data Session now there are 4 tables open: 3 tables, on which view is based and the view itself. My question is: how can I close these tables automatically? When I issue use in WorkConfig, all three underlying tables remain opened...
>>
>>Thanks in advance.
>
>Without writing a CloseView function, you can't. The function could parse the return value of Cursorgetprop("SQL",myView) to find the FROM clause and get the tables. Then it could issue a USE for the view as well as the tables.
>
>I recommend using the SQL property and not the Tables property because it is not inclusive. Tables only holds references to updateable tables and the view could include any number of no-updateable ones.
>
>Other than that, you need to remember to close them when you close the form. Are they causing a problem for you or are you just trying to clean up after yourself? Because the tables will close when the datasession they are opened in goes away.

Hi Larry,

Thanks for the reply. I see, it's not that simple, as I thought :) I vaguelly remember, I saw something about closing underlying tables in Booth, Sawyer's book (I just re-read it on page 37). Since currently I use a program, it uses Default DS and therefore tables remain opened. I'll write function CloseView.

Thanks for your help.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform