Solved

Who to create a password protected table?

Posted on 2002-05-08
1
147 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:
mnasman 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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 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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

746 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

11 Experts available now in Live!

Get 1:1 Help Now