Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to assign a password to a Paradox table Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
Assign a password to a Paradox table 25-Aug-02
Category
Database Others
Language
Delphi 2.x
Views
64
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

Assign a password to a Paradox table

Answer:

To assign a password to a Paradox table, use the following unit and call function 
TablePasswort like this:

1   uses Unit2;
2   // ..
3   TablePasswort(Table1, 'secret');
4   
5   unit Unit2;
6   
7   interface
8   
9   uses
10    BDE, SysUtils, DBTables, Windows;
11  
12  function TablePasswort(var table: TTable; password: string): Boolean;
13  
14  implementation
15  
16  function StrToOem(const AnsiStr: string): string;
17  begin
18    SetLength(result, Length(AnsiStr));
19    if Length(result) > 0 then
20      CharToOem(PChar(AnsiStr), PChar(result))
21  end;
22  
23  function TablePasswort(var table: ttable; password: string): Boolean;
24  var
25    pTblDesc: pCRTblDesc;
26    hDb: hDBIDb;
27  begin
28    result := false;
29    with table do
30    begin
31      if Active and (not Exclusive) then
32        Close;
33      if (not Exclusive) then
34        Exclusive := true;
35      if (not Active) then
36        Open;
37      hDb := DBHandle;
38      Close
39    end;
40    GetMem(pTblDesc, sizeof(CRTblDesc));
41    FillChar(pTblDesc^, sizeof(CRTblDesc), 0);
42    with pTblDesc^ do
43    begin
44      StrPCopy(szTblName, StrToOem(table.tablename));
45      szTblType := szParadox;
46      StrPCopy(szPassword, StrToOem(password));
47      bPack := true;
48      bProtected := true
49    end;
50    if DbiDoRestructure(hDb, 1, pTblDesc, nil, nil, nil, false) <> DBIERR_NONE then
51      exit;
52    if pTblDesc <> nil then
53      FreeMem(pTblDesc, sizeof(CRTblDesc));
54    result := true
55  end;
56  
57  end.


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC