troubleshooting Question

Move DBFs from one DB to another

Avatar of formadmirer
formadmirerFlag for United States of America asked on
FoxPro
2 Comments1 Solution559 ViewsLast Modified:
Hello all. I'm trying to move dbfs from one database to another. I thought this would be simple, but it's really stumping me.

Here's the latest I've tried:

lcCurrentDB = pData + "olddb"
lcNewDB = pData + "newdb"

OPEN DATABASE (lcCurrentDB) SHARED

SET DATABASE TO (lcCurrentDB)
lcName = "item_type"
lcTableName = pData + lcName
IF USED(lcTableName)
	USE IN ('lcTableName')
ENDIF
REMOVE TABLE (lcTableName)
SET DATABASE TO (lcNewDB)
ADD TABLE (lcTableName)

My idea was to simply iterate all my tables (about 20) through a block like above to remove them from the old db and associate them with the new.

I know I'm probably not approaching this correct in the code above.

Something that may be causing additional problems is the fact that this is necessary due to a program name change.

I thought to change the name all I would need to do was rename the .exe, the project files and the db, which I did through Windows Explorer, then recompiled.

Later I realized this might not have been the best approach, and I've been trying to move these tables to the newly named DB since.

Finally, I copied the old DB files back and they now reside in the same directory as the new (renamed) DB files.

I do have complete backups so if I've totally messed things up just let me know and I'll restore and start again.

Thanks!
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros