?
Solved

Close table

Posted on 2015-01-06
1
Medium Priority
?
253 Views
Last Modified: 2015-01-08
Hi
We are using VFP9 and using this SQP command to open a table.
 
sIncoming_TXTFile = ALLTRIM(GETFILE("TXT",'Select Incoming Portal Text File to import into FoxPro)','TXT File'))
sIncoming_DBFFile = LEFT(sIncoming_TXTFile,LEN(sIncoming_TXTFile)-LEN('.txt')) + '.dbf'

Wondering how I can just close this table?
Thanks
0
Comment
Question by:RVL
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 42

Accepted Solution

by:
pcelba earned 2000 total points
ID: 40533952
FoxPro can assign an alias name dependent on the current app environment state...
The best way is to open the file prior your SQL command and assign your own (and known) alias:

USE (sIncoming_DBFFile) ALIAS SomeKnownAlias IN 0
SELECT * FROM SomeKnownAlias INTO ...
USE IN SomeKnownAlias

Of course you may find the file in a loop through all open aliases:
lnCnt = AUSED(laAliases)
FOR lnI = 1 TO lnCnt
  IF UPPER(DBF(laAliases[lnI, 1])) == UPPER(sIncoming_DBFFile)
    USE IN (laAliases[lnI, 1])
  ENDIF
NEXT

Remember the fact some SQL SELECTs can also use the same DBF file for the result cursor.

Also your command
sIncoming_DBFFile = LEFT(sIncoming_TXTFile,LEN(sIncoming_TXTFile)-LEN('.txt')) + '.dbf'
can be reduced to:
sIncoming_DBFFile = ForceExt(sIncoming_TXTFile, 'DBF')
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
In today's business world, data is more important than ever for informing marketing campaigns. Accessing and using data, however, may not come naturally to some creative marketing professionals. Here are four tips for adapting to wield data for insi…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question