Solved

Who to create a password protected table?

Posted on 2002-05-08
1
149 Views
Last Modified: 2010-04-04
Can I create a password protected table(paradox) using createtable function? I need a example.
0
Comment
Question by:Seashore
1 Comment
 
LVL 22

Accepted Solution

by:
Mohammed Nasman earned 100 total points
ID: 6998204
Hello

  You can add password to paradox table using the BDE API, Here's an sample

uses
  Bde;

procedure AddMasterPassword(Table: TTable; pswd: string);

const
  RESTRUCTURE_TRUE = WordBool(1);
var
  TblDesc: CRTblDesc;
  hDb: hDBIDb;
begin
  if not Table.Active and not Table.Exclusive then
    Table.Close;
  if (not Table.Exclusive) then
      Table.Exclusive := true;
    if (not Table.Active) then
      Table.Active := True;
  FillChar(TblDesc, SizeOf(CRTblDesc), #0);
  with TblDesc do begin
    StrPCopy(szTblName, Table.TableName);
    StrCopy(szTblType, szPARADOX);
    StrPCopy(szPassword, pswd);
    bProtected := RESTRUCTURE_TRUE;
  end;
  Check(DbiGetObjFromObj(hDBIObj(Table.Handle), objDATABASE, hDBIObj(hDb)));
  Table.Close;
  Check(DbiDoRestructure(hDb, 1, @TblDesc, nil, nil, nil, False));
  Session.AddPassword(pswd);
  Table.Open;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  AddMasterPassword(Table1,'password');
end;

Best regards
Mohammed Nasman

0

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

863 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

24 Experts available now in Live!

Get 1:1 Help Now