Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread How to trap a database connection error?
Sat, Oct 14 2006 6:31 PMPermanent Link

"Marcio Ehrlich"
Is there a way to trap a connection error, as in the event of an inexistent
directory or a directory with no dat file at all?
I have tried this but the control never passed to the except section:

 With DBISAMDatabase1 do
   begin
     Connected := False;
     Directory := 'D:\CRAP';
     try
       Connected := True;
      except
       ShowMessage('Error');
     end;
   end;

Thanks,
Marcio

Sun, Oct 15 2006 12:49 AMPermanent Link

"Robert"

"Marcio Ehrlich" <marcioehrlich_at_ig.com.br> wrote in message
news:508BF761-0E3B-4FD6-8633-09810387DB12@news.elevatesoft.com...
> Is there a way to trap a connection error, as in the event of an
> inexistent
> directory or a directory with no dat file at all?

I look for a table that I know has to be there, before I even try to connect
the database. If D:\crap\mytable.dat is not there, bye bye.

Robert


Sun, Oct 15 2006 1:22 PMPermanent Link

Sanford Aranoff
if not DirectoryExists('crap') then
   write_err('Directory ' + 'crap' + ' does not exit')
else

Marcio Ehrlich wrote:

> Is there a way to trap a connection error, as in the event of an inexistent
> directory or a directory with no dat file at all?
Mon, Oct 16 2006 3:07 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Marcio,

<< Is there a way to trap a connection error, as in the event of an
inexistent directory or a directory with no dat file at all?
I have tried this but the control never passed to the except section: >>

DBISAM doesn't check the existence of the directory until it tries to open a
table in that directory.  I would recommend that you check the directory
with DirectoryExists() if you want to verify its existence.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image