[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

About table passwords...

Posted on 2000-05-09
3
Medium Priority
?
136 Views
Last Modified: 2010-04-04
I have an empty table named SENSEI.db with all its fields defined. I need to COPY this table at runtime with a different name and a password to begin working with this copy. How can I do this? By the way, is it possible to change the password to a table at runtime? How?
0
Comment
Question by:ajgonzalezm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 7

Accepted Solution

by:
Motaz earned 200 total points
ID: 2795466
See my Electronic Book (Delphi Programming Guide) in which you can find how to define Paradox master password and how to remove it, I copy it from Borland document and it works fine.
This is an example of defining password:

-----------------


At design time you can set a password for a paradox table using Database Desktop tool. At run-time you can set the password using direct BDE API functions. Below procedure can set a master password for Paradox tables, but you have to include BDE, DB, and DBTables in uses clause:


procedure AddMasterPassword(Table: TTable; pswd: string);
const
  RESTRUCTURE_TRUE = WordBool(1);

var
  TblDesc: CRTblDesc;
  hDb: hDBIDb;

begin
  { Make sure that the table is opened and is exclusive }
  if (Table.Active = False) or (Table.Exclusive = False) then
    raise EDatabaseError.Create('Table must be opened in exclusive mode to add passwords');
  { Initialize the table descriptor }
  FillChar(TblDesc, SizeOf(CRTblDesc), 0);

  with TblDesc do
  begin
    { Place the table name in descriptor }
    StrPCopy(szTblName, Table.TableName);
    { Place the table type in descriptor }
    StrCopy(szTblType, szPARADOX);
    { Master Password, Password }
    StrPCopy(szPassword, pswd);
    { Set bProtected to True }
    bProtected := RESTRUCTURE_TRUE;
  end;

  { Get the database handle from the cursor handle }
  Check(DbiGetObjFromObj(hDBIObj(Table.Handle), objDATABASE, hDBIObj(hDb)));
  { Close the table }
  Table.Close;
  { Add the master password to the Paradox table }
  Check(DbiDoRestructure(hDb, 1, @TblDesc, nil, nil, nil, FALSE));
  { Add the new password to the session }
  Session.AddPassword(pswd);
  { Re-Open the table }
  Table.Open;
end;


Example of calling password procedure

- Drop a Table.
- Set table's DatabaseName to any Alias and TableName to any Paradox table.
- Add bde to Unit1 uses section and make sure that DBTables and Db also added to uses section.

- Copy and paste above procedure in Unit1.
- Drop a button.
- At button's OnClick event write:

  Table1.Close;
  Table1.Exclusive:= True;
  Table1.Open;
  AddMasterPassword(Table1, 'test');


Notes:

- Befor setting password you have to make sure that the table is opened in exclusive mode.

- Password is case sensitive.

See also

Removing Paradox master password

----------

www.geocities.com/motaz1
EBook/ Delphi.zip
Motaz
0
 

Author Comment

by:ajgonzalezm
ID: 2796477
Thanks a lot Motaz. I haven't had time to try your solution on the computer but I'm sure it will work. Just in case it didn't be sure I will get back to you.

Thanks again.

AJ
0
 
LVL 7

Expert Comment

by:Motaz
ID: 2798863
Welcome any time AJ, I'm very happy that I could help you. If you need any help I'll be there.

Motaz
motaz1@yahoo.com
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

656 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