Solved

Who to create a password protected table?

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Printing problem 2 101
Press three keys together and trigger a function 3 60
Delphi inherited method 6 75
Twebbrowser add css to the header 3 27
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

808 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