Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't share .dbf's with SQL-Select

Status
Not open for further replies.

GKatReliable

Programmer
Jul 2, 2002
45
US
We write programs (Fox 2.6a) that go against a production multi-user system, and we have good success using "USE filename SHARED" so that everyone doesn't have to exit the application when the programs run, and continue to have these .Dbf's open.
However, whenever we write something that does the SQL-Select, "SELECT fieldname FROM filename...", file contention rears its ugly head. Any programming workaround for this?
Regards,
Glenn Koproske

 
Glenn,
Are you using INTO TABLE, or INTO CURSOR? Do you keep your temp files and/or tables on the local system or on the file server? Do you always SELECT from a single table and only from existing fields? (i.e. You don't include any computed or formated fields.)

Rick
 
Most of the time, it is INTO TABLE.
All files are on the server, but it is just a file and print server.
Most of the time the SELECT is done against 2 tables, and there are some that include a calculation but more often, just selecting existing fields in the .Dbf's.
 
Glenn,
When you select into a table, do you create unique names for them, so that there won't be any conflict between users? e.g.
Code:
tabname = sys(3)
SELECT * from orgtable ;
 where name="SMITH" ;
 into TABLE (tabname)
Note: When you Select from a single table with no computed fields into a cursor, then you will almost always end up with a pseudo cursor that's really nothing more than pointers to the filtered set of records in the original file.

Rick
 
Rick Bean has the right questions (as usual).

Have you used Foxpro in an interactive manner to see if this file contention error occurs when initially accessing the Source table(s) or when it is writing out to the Destination table?

If the latter....
I have found when gathering data from a multi-user, networked system into temporary tables (result from SELECT - SQL) for reporting purposes, etc. it is best to have them written to the user's individual workstation TEMP directory (on Drive C) and then purge them after use.

In that way there is no contention within a single common TEMP directory on the server for files which do not need to be permanent.

Good Luck,


JRB-Bldr
VisionQuest Consulting
Business Analyst & CIO Consulting Services
CIOServices@yahoo.com
 
Try this

add following lines in your config.fp/config.fpw

TMPFILES=c:\WINDOWS\TEMP
EDITWORK=c:\WINDOWS\TEMP
SORTWORK=c:\WINDOWS\TEMP
PROGWORK=c:\WINDOWS\TEMP

restart foxpro, then try

sele * from customer into cursor mytmp

NOTE : use DBF in excl ON/OFF does not matter select SQL handle USE AGAIN NOUP machanism
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top