Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Opening all dbfs in a directory
Message
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01585571
Message ID:
01585589
Views:
76
>Use ADIR() to get a list of dbf files, then loop through the resulting array.
>
>>I have been hit twice in the last month by a virus which causes not a table error when a dbf is opened
>>
>>Is there anyway I can open one by one all the tables in a directory to see if I still have any corrupt tables
>>
>>Colin

This is my code - it opens the first database and then errors trying to get the second with Funcion argument value type or count is invalid - I must be missing something very obvious

CLEAR
CLEAR ALL
SET EXACT ON
SET TALK off
SET DEFAULT TO c:\global
PUBLIC dbfs,cta
DIMENSION dbfs(1000)
DIMENSION gadatabase(1000)
gadatabase=""


gnDbcnumber = ADIR(gaDatabase, '*.DBF') && Create array
FOR nCount = 1 TO gnDbcnumber && Loop for number of databases
dbfs(ncount)=gadatabase(ncount,1)
ENDFOR


STORE ncount TO cta

DIMENSION dbfs(cta)


FOR xxxx=1 TO cta
STORE ALLTRIM(dbfs,xxxx) TO tablex
tablex=ALLTRIM(tablex)
USE &tablex IN 0 SHARED
next
Specialist in Advertising, Marketing, especially Direct Marketing

I run courses in Business Management and Marketing
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform