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

Author: Man-wai Chang

Posted: 2015-07-16 at 05:19:09

On Mon, Jul 13, 2015 at 11:27 PM, Ken Dibble <krdibble@stny.rr.com> wrote:

> Question 1: Does a SQL SELECT place a lock on a VFP .dbf table such that the

> same user can't issue a USE on the table while the query is running?

It will open a table in shared mode. It seemed that a table or an

alias referred by a SQL query was already opened. The SQL query might

have been fired twice by different windows.

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

issuing any USE _table_name_! Here is an example:

SELECT 0

IF USED("customer")

SELECT customer

ELSE

USE customer SHARED READONLY

ENDIF

EXECUTE_SQL_QUERY()

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

> 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!

--

.~. Might, Courage, Vision. SINCERITY!

/ v \ 64-bit Ubuntu 9.10 (Linux kernel 2.6.39.3)

/( _ )\ http://sites.google.com/site/changmw

^ ^ May the Force and farces be with you!

_______________________________________________

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/CAGv=MJAzTFCLRMai=T_RnovtJfCPHqeN_WdTB3+KF891R2-r6g@mail.gmail.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 Man-wai Chang