Re: Delphi handling of SQL server generated errors
- From: Metal Dave <metal@xxxxxxxxx>
- Date: Thu, 21 Apr 2005 17:39:01 -0400
On Wed, 20 Apr 2005 17:59:43 -0400, Metal Dave <metal@xxxxxxxxx>
wrote:
>As I understand it, Delphi should raise an Exception whenever a client
>app that is connected to an SQL Server runs an SQL statment that
>fails. Anotherwords, whenever SQL Server rasies an error using the
>"raiserror" statement in SQL Delphi should raise an exception in the
>client application. However I noticed some unexpected behavior when
>running some SQL scripts that caused errors, and have reduced the
[...]
>So my impression is that a delphi component will hide any errors
>raised by an SQL batch run against SQL Server, assuming that the batch
>has had at least one successful insert or select statement previously
>in the batch. Has anyone else noticed anything along these lines?
I found a post online regarding a similar problem that suggested the
following solution:
Make sure you have SET NOCOUNT ON at the beginning of your procs and
triggers. This will suppress DONE_IN_PROC messages that are returned
as empty closed recordsets in ADO.
A simple test confirms that adding this statement to the begining of
the batch works. However I'm not sure if editing every script to put
that in is an option. Alternatively, I'd like to access the underlying
ado properties to set the property "IGNORE_DONE_IN_PROC" to true.
However I've tried both:
ADOConnection1.Properties.Item[IGNORE_DONE_IN_PROC'].Value := 'true';
and
ADOCommand1.Properties.Item['IGNORE_DONE_IN_PROC'].Value := 'true';
and both raise an exception message "item cannot be found in the
collection corresponding to the requested name or ordinal".
Any suggestions?
Dave
.
- Follow-Ups:
- Re: Delphi handling of SQL server generated errors
- From: Metal Dave
- Re: Delphi handling of SQL server generated errors
- References:
- Delphi handling of SQL server generated errors
- From: Metal Dave
- Delphi handling of SQL server generated errors
- Prev by Date: Re: Detecting shift/alt keys
- Next by Date: Re: Delphi handling of SQL server generated errors
- Previous by thread: Delphi handling of SQL server generated errors
- Next by thread: Re: Delphi handling of SQL server generated errors
- Index(es):
Relevant Pages
|