Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Packing a VFP table through ODBC
Message
 
To
20/10/1998 15:53:25
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00148623
Message ID:
00148651
Views:
32
Check this out. You may find it useful.

This is the Visual C++ setup that calls the pack program in VFP.
The location of the data base are in an .ini file.
This routine is in the destructor of MainFrame.
------------------------
// Eliminate records in the database that have been marked for deletion
char dbPath[MAX_PATH];
GetPrivateProfileString("DBLOCATION", "FILE", "", dbPath, MAX_PATH, INI_FILE);
CString Packloc;
Packloc.Format("%s%s%s", dbPath,"\\yourpack.exe ", dbPath);
if (WinExec(Packloc, SW_HIDE) < 31)
{
ptr_MessageClass ->GetOKMessage(IDS_PACK_DB_ERROR);
}
---------------------------

This is the pack program (yourpack) written in VFP
---------------------------------------------
PARAMETERS gnpath
thepath = gnpath
set path to &thepath
ON SHUTDOWN DO yourshutdown
PUBLIC filespacked, totfiles
filespacked = 0
totfiles = 3
open database yourdbname
use yourtable1
pack
filespacked = filespacked + 1
use yourtable2
pack
filespacked = filespacked + 1
use yourtable3

&& etc….depending on the number of tables

QUIT
----------------------------------------------

This is the shutdown program (yourshutdown) written in VFP
formsg2 = "Not all of the database table records marked for deletion were deleted!"
IF filespacked = totfiles
nreturn = 0
ELSE
nreturn = MESSAGEBOX(formsg2, 48, "Your Warning!")
ENDIF
QUIT


There may be a better way, but this works for me. Good luck. Don West.

>Hi,
> I am working on a Visual C++ program which access a VFP 5.x database through ODBC. When I delete a record from a table, it is still in the table, but marked as delete. I want to remove deleted records permanently from tables.
>How to Pack the tables through ODBC?
>
>Thanks
>Puri
Previous
Reply
Map
View

Click here to load this message in the networking platform