Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 01-18-2001, 07:44 AM
herosbh herosbh is offline
Junior Member
 
Join Date: Jan 2001
Posts: 25
Default Rebuild indexes in Paradox 7

What is the best software to rebuild my indexes in Paradox 7? Where can I find it?

Thanks since now!!!
Heros
Reply With Quote
  #2  
Old 01-18-2001, 11:04 AM
rdaniel2000 rdaniel2000 is offline
Senior Member
 
Join Date: Jul 2001
Posts: 105
Default RE: Rebuild indexes in Paradox 7

Download the TIPS of CodeBank
Reply With Quote
  #3  
Old 01-21-2001, 10:21 PM
rdaniel2000 rdaniel2000 is offline
Senior Member
 
Join Date: Jul 2001
Posts: 105
Default RE: Rebuild indexes in Paradox 7

{If you use the DBgrid and DBNavigator to delete records in a table
which has unique fields, you will find that the table grows
relentlessly and you can't re-enter the same data without packing
the table first.

The following routine (tricky bits courtesy of Mike Orriss) will
pack and reindex a DBase and (according to Mike) Paradox table,
taking from a few seconds to a few minutes. Tested with a 650K
DBaseIV file. Much quicker after the first call.

Freeware. I accept no responsibility for loss or corruption of
data, so MAKE BACKUPS BEFORE EXPERIMENTING.

Just add the code below to the relevant sections. Call the
function with your table's name, then wait while it grinds
away. Returns True if the table is packed successfully.}

{add to Uses}

WinProcs, Classes, SysUtils, StdCtrls, Forms,
Controls, DB, DBIProcs, DBITypes, DBIErrs, DBTables;

{Add to declarations}

function PackTable(tbl:TTable): Boolean;

{Add to Implementation}

function PackTable(tbl:TTable): Boolean;
{Packs a DBaseIV (and Paradox?) table}
var
crtd: CRTblDesc;
db: TDataBase;
begin
try
Screen.Cursor := crHourglass;
Result := True;
with tbl do
begin
db := DataBase;
If Active then
Active := False;
if not db.Connected then
db.Connected := True;
FillChar( crtd, SizeOf( CRTblDesc ), 0 );
StrPCopy( crtd.szTblName, TableName );
crtd.bPack := True;
If DbiDoRestructure( db.Handle, 1, @crtd, nil, nil, nil, False )
<> DBIERR_NONE then
Result := False;
Open;
end; {with}
except
on Exception do {any exception}
Result := False;
end; {try..except}
Screen.Cursor := crDefault;
end; {procedure}

================================================== ===
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 04:15 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.