Delphi Programming question

Posted on 1997-09-24
Last Modified: 2010-04-04
I would like to "Pack" my paradox-table at run-time. By packing I am refering to deleting empty records. In the Database Desktop you can do this when selecting "Restructure", but I want this to be automatic within my application.

I use Delphi Developer 2.0.

Erik N
Question by:Erik N

Accepted Solution

Waldek earned 0 total points
ID: 1346161
Try this
  uses  DBIProcs, DBITypes, DBIErrs;

  function PackTable(table:TTable; db:TDatabase):DBIResult;
    crtd: CRTblDesc;
    Result := DBIERR_NA;
    with table do if Active then Active := False;
    with db do if not Connected then Connected := True;
    crtd.bPack := True;
    Result := DbiDoRestructure(db.Handle,1,@crtd,nil,nil,nil,FALSE);

Example of use:

  procedure TForm1.Button1Click(Sender: TObject);
    if PackTable(Table1,DataBase1) = DBIERR_NONE then .....
    else MessageBeep(0);

Author Comment

by:Erik N
ID: 1346162
Good help there Waldek. Thanx!
Erik N.

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
loading dll from external path 1 211
Internet Explorer View Settings Question 15 106
Reconfigure Delphi Install? 2 46
Delphi: Connect to running MS Outlook 4 48
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

895 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now