Exceptions not treated properly with SQL Server Express 2005 database
- From: Radu Stanciu <urgur@xxxxxxx>
- Date: Thu, 18 May 2006 22:43:30 +0300
Hi,
I'm using an ADOConnection object to connect to a SQL Server 2005 server and I want to catch the exception that occurs in case the application is trying to connect and the server is not running (or not installed).
The code I have is pretty simple:
try
// initializing main database connection
DataModuleMain.SQLServerConnection.Open;
except
on E: EOleException do MessageBox(Handle, PChar(E.Message), 'ERROR', mb_OK);
end;
The problem is that even the connection fails, the application doesn't go into the except clause, but rather throws a delphi exception saying "raised exception class EOleException with message 'SQL Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF]'". Is there a way I can catch and treat this exception myself? Are there any connection properties that I'm missing?
I've also tested on an invalid query and the behavior is similar, the exception does not get handled.
Thanks for your help.
Radu Stanciu
.
- Follow-Ups:
- Re: Exceptions not treated properly with SQL Server Express 2005 database
- From: Graham Harris
- Re: Exceptions not treated properly with SQL Server Express 2005 database
- Prev by Date: Re: ADO parameter problem
- Next by Date: Re: Can't Delete Records from an MS Access DB
- Previous by thread: Cannot open Access table with ADO or BDE/ODBC
- Next by thread: Re: Exceptions not treated properly with SQL Server Express 2005 database
- Index(es):
Relevant Pages
|