Board index » delphi » Problem with logon to (local) Paradox table

Problem with logon to (local) Paradox table

Logon to Paradox table

When I use the code below, there is a problem.

{-------------------------}
procedure TForm1.PasswordProc(Sender: TObject; Var Continue :
Boolean);
Begin
  Session.RemoveAllPasswords;
  Session.AddPassword(psswrd);
  Continue := True;
End;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Session.OnPassword := PasswordProc;
  Table1.Active := True;
end;
{-------------------------}

What is happening:
After clicking the button, and string psswrd holds the right password,
Table1 becomes active. This works fine.
However, if the password is wrong, the application locks up when
setting Tabel1's property active to true.

What do I want to happen:
If the password provided by the user is wrong, I want to show a
message.
I want to prevent the application from locking up and I don't want to
use the default login screen from the DBE.

What should I do? Please give an example.

Thank you,
Robert

 

Re:Problem with logon to (local) Paradox table


Why do you do like this?
Lock the table with one password you will know only...

Make other password system. When that password passes, then unlock table with right password.

---
FA Beli/Fleet Commader/PLT Loch/ISF
[MoIx4][IDMx2][SSx2][GS][MoH]
ISF-1998030106
http://www.imperialstarfleet.com
---
Jedi Master Beli/ATD/Dark Council/Advisor of SoH
[VC][CD][BTM][STM][GTM][GSC]
http://www.sauron.co.yu/atd
---
http://www.sauron.co.yu
ICQ No. 1878554

Quote
  ----- Original Message -----
  From: Dani?l Maartense
  To: beli-n...@fido.org.yu
  Sent: Tuesday, 30 May, 2000 19:35 PM
  Subject: Problem with logon to (local) Paradox table

  Logon to Paradox table

  When I use the code below, there is a problem.

  {-------------------------}
  procedure TForm1.PasswordProc(Sender: TObject; Var Continue :
  Boolean);
  Begin
    Session.RemoveAllPasswords;
    Session.AddPassword(psswrd);
    Continue := True;
  End;

  procedure TForm1.Button1Click(Sender: TObject);
  begin
    Session.OnPassword := PasswordProc;
    Table1.Active := True;
  end;
  {-------------------------}

  What is happening:
  After clicking the button, and string psswrd holds the right password,
  Table1 becomes active. This works fine.
  However, if the password is wrong, the application locks up when
  setting Tabel1's property active to true.

  What do I want to happen:
  If the password provided by the user is wrong, I want to show a
  message.
  I want to prevent the application from locking up and I don't want to
  use the default login screen from the DBE.

  What should I do? Please give an example.

  Thank you,
  Robert

Re:Problem with logon to (local) Paradox table


Use:

type
  TForm1 = class(TForm)
    ...
  private
    SessionRetry: Integer;
    ...
  end;

procedure TForm1.Session_OnPassword(Sender: TObject; var Continue: Boolean);
begin
  Continue := (SessionRetry = 0);
  if Continue then
  begin
    Session.RemoveAllPasswords;
    Session.AddPassword(Password);
    Inc(SessionRetry);
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Table1.Session.OnPassword := Session_OnPassword;
  try
    SessionRetry := 0;
    Table1.Open;
  except
    on E: EDBEngineError do
    begin
      for i := 0 to E.ErrorCount - 1 do
        if E.Errors[i].ErrorCode = 10498 then
        begin
          MessageDlg('Invalid password', mtError, [mbOk], 0);
          Exit;
        end;
      raise;
    end;
  end;
end;

"Dani?l Maartense" <dmaarte...@hotmail.com> schreef in bericht
news:393641cc.2119744@news.hetnet.nl...

Quote
> Logon to Paradox table

> When I use the code below, there is a problem.

> {-------------------------}
> procedure TForm1.PasswordProc(Sender: TObject; Var Continue :
> Boolean);
> Begin
>   Session.RemoveAllPasswords;
>   Session.AddPassword(psswrd);
>   Continue := True;
> End;

> procedure TForm1.Button1Click(Sender: TObject);
> begin
>   Session.OnPassword := PasswordProc;
>   Table1.Active := True;
> end;
> {-------------------------}

> What is happening:
> After clicking the button, and string psswrd holds the right password,
> Table1 becomes active. This works fine.
> However, if the password is wrong, the application locks up when
> setting Tabel1's property active to true.

> What do I want to happen:
> If the password provided by the user is wrong, I want to show a
> message.
> I want to prevent the application from locking up and I don't want to
> use the default login screen from the DBE.

> What should I do? Please give an example.

> Thank you,
> Robert

Re:Problem with logon to (local) Paradox table


Thank you mr. Avegaart.
Het was precies wat ik zocht.

On Wed, 31 May 2000 13:46:33 +0200, "M.H. Avegaart"

Quote
<avega...@NOSPAMmccomm.nl> wrote:
>Use:

>type
>  TForm1 = class(TForm)
>    ...
>  private
>    SessionRetry: Integer;
>    ...
>  end;

>procedure TForm1.Session_OnPassword(Sender: TObject; var Continue: Boolean);
>begin
>  Continue := (SessionRetry = 0);
>  if Continue then
>  begin
>    Session.RemoveAllPasswords;
>    Session.AddPassword(Password);
>    Inc(SessionRetry);
>  end;
>end;

>procedure TForm1.Button1Click(Sender: TObject);
>begin
>  Table1.Session.OnPassword := Session_OnPassword;
>  try
>    SessionRetry := 0;
>    Table1.Open;
>  except
>    on E: EDBEngineError do
>    begin
>      for i := 0 to E.ErrorCount - 1 do
>        if E.Errors[i].ErrorCode = 10498 then
>        begin
>          MessageDlg('Invalid password', mtError, [mbOk], 0);
>          Exit;
>        end;
>      raise;
>    end;
>  end;
>end;

>"Dani?l Maartense" <dmaarte...@hotmail.com> schreef in bericht
>news:393641cc.2119744@news.hetnet.nl...
>> Logon to Paradox table

>> When I use the code below, there is a problem.

>> {-------------------------}
>> procedure TForm1.PasswordProc(Sender: TObject; Var Continue :
>> Boolean);
>> Begin
>>   Session.RemoveAllPasswords;
>>   Session.AddPassword(psswrd);
>>   Continue := True;
>> End;

>> procedure TForm1.Button1Click(Sender: TObject);
>> begin
>>   Session.OnPassword := PasswordProc;
>>   Table1.Active := True;
>> end;
>> {-------------------------}

>> What is happening:
>> After clicking the button, and string psswrd holds the right password,
>> Table1 becomes active. This works fine.
>> However, if the password is wrong, the application locks up when
>> setting Tabel1's property active to true.

>> What do I want to happen:
>> If the password provided by the user is wrong, I want to show a
>> message.
>> I want to prevent the application from locking up and I don't want to
>> use the default login screen from the DBE.

>> What should I do? Please give an example.

>> Thank you,
>> Robert

Other Threads