Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Close table

Posted on 2015-01-06
1
Medium Priority
?
264 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 43

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
What we learned in Webroot's webinar on multi-vector protection.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
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…
Suggested Courses

604 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