🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.database
Article #2076

How to detect a Database Login Error

#2076
From: Stefaan Lesage
Date: Fri, 06 Mar 1998 00:00
56 lines
3082 bytes
Hi folks,

I am currently developing an application using Delphi 3 C/S and
Interbase as a database.  On my main (startup) form I have placed a
TDatabase component, and on creation of the form, the
TDatabase.Connected property is set to True to bring up a login dialog
box.  But now comes my problem.

When the user enters a wrong UserID or PassWord, the application sends
an EDBEngineError and the program is terminated.  Is there some way I
could trap this error ? And maybe display a mesagebox with a more
meaningfull Message and letting the user try again ?

I know that it will have something to do with a try and except block,
but I already tried out many things, and none worked.  I added the
following code to my project  (where dbPOD is the database component)
:

     Try
          dbPOD.Connected := true;
     Except
          on E: EDBEngineError do
          begin
               ShowMessage ('Database Error');
          end;
          else ShowMessage ('Error Detected');
     end;

In my opinion this should shouw my errormessage when the user types in
the wrong username or password, or am I wrong ? Actually it doesnt do
anything none of the two messages are displayed.  What am I doing
wrong here ? If anybody can help me with this problem, or send me some
sample code on how exactly I shoud do this, I would really appreciate
it.

By the way, I have another question too, but this one isn't that
urgent.  Is there some way to determine the LOGIN ID of the user that
has logged into the Interbase Database ? I will need this because the
administrator should have all options enabled, and the other users
should only have the necessary parts of the application enabled.


If anybody can help me out with this, I would really appreciate it.

Please send a copy of your answer to my e-mail adress too.

Thanks,



--

Stefaan Lesage
Fotek nv; Belgium
Stefaan@fotek.com
Technical Details
Message-ID: <6doio8$4j7$1@news3.Belgium.EU.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ffff5,a9c1af997a9ef57b,start
X-Google-Attributes: gidffff5,public
X-Google-Thread: ff75c,a9c1af997a9ef57b,start
X-Google-Attributes: gidff75c,public
X-Google-Thread: 115d96,a9c1af997a9ef57b,start
X-Google-Attributes: gid115d96,public
X-Google-Thread: 10de66,a9c1af997a9ef57b,start
X-Google-Attributes: gid10de66,public
X-Google-Thread: 11314c,a9c1af997a9ef57b,start
X-Google-Attributes: gid11314c,public
X-Google-Thread: f6386,a9c1af997a9ef57b,start
X-Google-Attributes: gidf6386,public
From: "Stefaan Lesage" <stefaan@fotek.com>
Subject: How to detect a Database Login Error
Date: 1998/03/06
Message-ID: <6doio8$4j7$1@news3.Belgium.EU.net>
X-Deja-AN: 331365214
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3
Organization: Fotek
Newsgroups: borland.public.delphi.database,borland.public.delphi.database.desktop,borland.public.delphi.database.multi-tier,borland.public.delphi.database.sqlservers,borland.public.interbase,comp.lang.pascal.delphi.databases