Re: "File In Use" on USE "during" SQL SELECT Execution

Author: Ken Dibble

Posted: 2015-07-16 at 08:21:05

>A quick-and-dirty solution is to check USED("_table_name_") before

>issuing any USE _table_name_! Here is an example:

Thank you. I always do that. In fact, my framework has a data manager class

that handles this, so USE and SELECT are only issued in one place. If

USED() is .T., then I SELECT that work area.

However, I have also seen this before, rarely, in other situations:

IF NOT USED("mytable")

USE mytable IN 0 && Error 3; File in use.

ENDIF

I kid you not. It's very strange.

I actually think there are processes in VFP that impose locks on tables

that aren't always detected correctly. In the above case, it would seem

that some OTHER user has the table open and locked for some purpose. The

error reported should be 108, but sometime's it's 3.

I don't use USE AGAIN or ALIAS SomethingDifferent because it complicates

the task of keeping track of what's been opened.

>You might also consider using USE...AGAIN ALIAS.... in all your SQL queries.

I don't use USE AGAIN or ALIAS SomethingDifferent because it complicates

the task of keeping track of what's been opened.

> > Question 2: Insofar as possible, should I program defensively by disabling

> > controls related to shutting down while queries are running?

>

>Why not use modal windows all the time so that users are always using

>one window a time!

Most of my windows are modal, but sometimes people have to switch back and

forth between two open windows to accomplish a task.

Thanks.

Ken

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox

OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/5.2.1.1.1.20150716091231.0209d858@POP-Server.stny.rr.com

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2015 Ken Dibble