Solved

Delphi Programming question

Posted on 1997-09-24
2
138 Views
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.

Thanks!
Erik N
0
Comment
Question by:Erik N
2 Comments
 
LVL 2

Accepted Solution

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

  function PackTable(table:TTable; db:TDatabase):DBIResult;
  var
    crtd: CRTblDesc;
  begin
    Result := DBIERR_NA;
    with table do if Active then Active := False;
    with db do if not Connected then Connected := True;
    FillChar(crtd,SizeOf(CRTblDesc),0);
    StrPCopy(crtd.szTblName,table.TableName);
    crtd.bPack := True;
    Result := DbiDoRestructure(db.Handle,1,@crtd,nil,nil,nil,FALSE);
  end;

Example of use:

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

Author Comment

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

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

791 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