Board index » delphi » How to login Paradox table with TDatabase

How to login Paradox table with TDatabase

Are there any suggestions or experience out there on how to do this?
I try to login by using as

TDatabase :
---------------
LoginPrompt = False
Params = Password = xxxxxx

but error !!

 

Re:How to login Paradox table with TDatabase


Quote
On Mon, 10 May 1999 11:42:12 +0800, "Sunboy" <dym...@ms3.url.com.tw> wrote:
>Are there any suggestions or experience out there on how to do this?
>I try to login by using as

>TDatabase :
>---------------
>LoginPrompt = False
>Params = Password = xxxxxx

>but error !!

Password protection for Paradox tables is done at the table level. The
TDatabase login processes are based on security at the database level. The
two are conceptually incompatible.

However, there is a special facility built into Delphi for handling the
table-level security scheme used by Paradox: the TSession.OnPassword event.
When an attempt is made to open a Paradox table and the attempt is
unsuccessful due to password protection, an OnPassword event is generated
(for the session in use, typically the default session). You can create a
handler for this event and call the TSession.AddPassword method. The sole
parameter for AddPassword is a String type value containing the password to
add. The source of this String value can vary greatly depending on the
context of the situation: a String literal in the application, user entry
via a custom dialog, a Windows Registry entry, an entry in an INI file, and
so on.

In the example below, the application procedure Password is designated as
the handler for the OnPassword event by assigning the procedures name to
the TSession.OnPassword property.

  procedure TForm1.FormCreate(Sender: TObject);
  begin
    Session.OnPassword := Password;
  end;

In the Password procedure, the InputBox function is used to prompt the user
for a password. The TSession.AddPassword method is used to programmatically
supply the password entered in the dialog to the session.

  procedure TForm1.Password(Sender: TObject; var Continue: Boolean);
  var
    Passwrd: String;
  begin
    Passwrd := InputBox('Enter password', 'Password:', '');
    Session.AddPassword(Passwrd);
    Continue := (Passwrd > '');
  end;

Be sure to set the Continue parameter in the event handler to reflect the
success of the operation and finalize the adding of the password (if True).

//////////////////////////////////////////////////////////////////////////
Steve Koterski                    "My problem lies in reconciling my gross
Technical Publications            habits with my net income."
INPRISE Corporation                             -- Errol Flynn (1909-1959)
http://www.borland.com/delphi

Other Threads