Solved

Who to create a password protected table?

Posted on 2002-05-08
1
150 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

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…
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

810 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