RE: Ignore SQL Server errors?
From: Steve Norman (SteveNorman_at_discussions.microsoft.com)
Date: 03/07/05
- Next message: Dumitru Sbenghe: "Re: OleDbConnection using system DSN problem"
- Previous message: Fredrik Wahlgren: "Re: Jet 4.0, ISAM and Excel"
- In reply to: Cowboy (Gregory A. Beamer) - MVP: "RE: Ignore SQL Server errors?"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 7 Mar 2005 08:23:13 -0800
As suggested, I have written a small SP to throw the Divide by Zero error,
and catch it, then select a string to display (see below).
When this is run in Query Analyser I get the error thrown and displayed, and
also the string is returned in the grid view. What would you change to stop
this throwing up the error?
Thanks,
Steve
CREATE PROCEDURE [dbo].[divzero]
AS
DECLARE @ErrNum int
SELECT @ErrNum = 100/0
SELECT @ErrNum = @@ERROR
SELECT 'DivZero'
GO
"Cowboy (Gregory A. Beamer) - MVP" wrote:
> I would have to see the code, as a captured error should not throw up the
> stack. Is this a long running sproc? If so, you may actually have a timeout
> instead of an error thrown up. The easiest test would be to implement a sproc
> you know will only take a second but throw an error. Then, catch with @@ERROR
> and see if you still get the SqlException. If not, the problem is not SQL
> error handling.
>
>
> ---
>
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
>
> ***************************
> Think Outside the Box!
> ***************************
>
> "Steve Norman" wrote:
>
> > Hi,
> >
> > I am executing a SQL Server SP to get a DataSet through SqlDataAdapter.Fill.
> > The problem I have is that sometimes the SP will throw a divide by zero
> > error which causes a SqlException, even though the error is handled in the SP.
> >
> > Is there anyway of stopping this error being thrown, as the SP will return
> > the correct data after the divide by zero error has occured? I have tried
> > setting ContinueUpdateOnError = True but this does not seem to do anything.
> >
> > Thanks,
> > Steve
- Next message: Dumitru Sbenghe: "Re: OleDbConnection using system DSN problem"
- Previous message: Fredrik Wahlgren: "Re: Jet 4.0, ISAM and Excel"
- In reply to: Cowboy (Gregory A. Beamer) - MVP: "RE: Ignore SQL Server errors?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|