.NET Zip component, Delphi Zip component, Barcode .NET, BDE Replacement and other .NET and Delphi components from ComponentAce
Products Download Order Contact us

Search
 

Delphi/C++ Components
.NET Components
ActiveX Controls
Kylix Components

Download

Download
Download Commercial
Trial Limitations

Support

Submit Request
Support Options

Order

Purchase
Competitive Upgrade
Premium Support
Sales Policy
Upgrade Policy
License Types

Info

News
Mailing List
Articles
Testimonials



About Us
Partners
Links
Contact Us
Link to Us





Home > Delphi/C++ Components > Absolute Database > Encrypted Database Delphi Example

Absolute Database

Overview | Features | Requirements | Testimonials | SQL Samples | Code Samples | Screenshots | See Also | Download | Order
Encrypted Database Delphi Example
Illustrates how to work with encrypted database

Download Absolute Database | Learn more

unit Main;

interface
{$I CompVer.inc}

uses
{$IFDEF D6H}
  Variants,
{$ENDIF}
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Grids, DBGrids, DB,
  ABSMain,
  ABSSecurity;

const DataBaseFileName = '..\..\Data\Demos.abs';

type
  TfrmMain = class(TForm)
    DBGrid1: TDBGrid;
    btnChange: TButton;
    btnCreate: TButton;
    dbDemos: TABSDatabase;
    db: TABSDatabase;
    tEmployeeDemos: TABSTable;
    btnOpen: TButton;
    tEmployee: TABSTable;
    DataSource1: TDataSource;
    sdDatabase: TSaveDialog;
    odDatabase: TOpenDialog;
    Label1: TLabel;
    GroupBox1: TGroupBox;
    Label2: TLabel;
    procedure FormCreate(Sender: TObject);
    procedure btnCreateClick(Sender: TObject);
    procedure btnOpenClick(Sender: TObject);
    procedure dbPassword(Sender: TObject; var Continue: Boolean);
    procedure btnChangeClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmMain: TfrmMain;

implementation

uses uDatabase;

{$R *.dfm}

procedure TfrmMain.FormCreate(Sender: TObject);
var CurDir: String;
begin
  CurDir := ExtractFilePath(Application.ExeName);
  odDatabase.InitialDir := CurDir;
  sdDatabase.InitialDir := CurDir;
  dbDemos.DatabaseFileName := CurDir + DataBaseFileName;
  dbDemos.Open;
  tEmployeeDemos.Open;
end;

procedure TfrmMain.btnCreateClick(Sender: TObject);
begin
  if frmDatabase.ShowModal = mrOk then
   begin
    db.Password := frmDatabase.ePassword1.Text;
    db.CryptoAlgorithm := TABSCryptoAlgorithm(frmDatabase.cbCryptoAgorithm.ItemIndex);
    if sdDatabase.Execute then
     begin
      db.Close;
      db.DatabaseFileName := sdDatabase.FileName;
      db.CreateDatabase;
      tEmployeeDemos.CopyTable(tEmployeeDemos.TableName, db.DatabaseFileName, db.Password);
      tEmployee.Open;
      btnChange.Enabled := True;
     end;
   end;
end;

procedure TfrmMain.btnOpenClick(Sender: TObject);
begin
  if odDatabase.Execute then
   begin
    db.Close;
    db.DatabaseFileName := odDatabase.FileName;
    tEmployee.Open;
    btnChange.Enabled := True;
   end;
end;

procedure TfrmMain.dbPassword(Sender: TObject; var Continue: Boolean);
var pwd: String;
begin
  Continue := InputQuery('Database Password', 'Please enter pasword:', pwd);
  db.Password := pwd;
end;

procedure TfrmMain.btnChangeClick(Sender: TObject);
begin
  if frmDatabase.ShowModal = mrOk then
   begin
    db.Close;
    db.ChangePassword(frmDatabase.ePassword1.Text,
                      TABSCryptoAlgorithm(frmDatabase.cbCryptoAgorithm.ItemIndex));
    tEmployee.Open;
   end;
end;

end.



Encrypted Database Delphi Example
Download Absolute Database | Learn more


Product Info


Current version: 7.95
Released: February 08, 2023
Price: $ 149

downloadorder


Our Customers



Testimonials

I don't think I've ever had a better support experience in regard to any of the 3rd party tools we use.

Tim Stickley

        © 2003 - 2024 ComponentAce  | .net zip component | barcode for .net | delphi zip component | delphi database Dec 26, 2024