Re: What SqlExceptions can be thrown



Thanks. So, it would be safe to assume that for some reason or another that
my stored procedure failed, and I could just log it and deal with the
failure. There is no case where a SqlException exception would be
informational, but not indicate a complete failure?

Diane

"Nicholas Paldino [.NET/C# MVP]" wrote:

> Diane,
>
> If all you need to know is if the stored procedure you ran completed
> successfully, then all you have to do is determine whether or not there was
> an exception, if not, then the command succeeded.
>
> As for what SqlExceptions might be thrown, the SqlException class will
> have more information based on the specific errors that SQL server returns.
> In the end though, it's that one exception that is thrown, with additional
> information.
>
> Is there a particular error that you are trying to catch from SQL
> server? If so check the Errors property on the exception instance and then
> look at the Number property of the individual errors, checking against the
> specific errors you are looking for.
>
> Hope this helps.
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx
>
>
> "Diane Droubay" <Diane Droubay@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:5366CCD9-7EB8-435F-8441-B442D44A4679@xxxxxxxxxxxxxxxx
> > to my application?
> >
> > In my web service, I'm using the Sql Data provider for .NET. I put the
> > code
> > that sets up parameters, my call to Connection.Open(), and to
> > Command.ExecuteNonQuery() in a try block, then catch SqlException.
> >
> > The problem is, I have been unable to determine what SqlExceptions might
> > be
> > thrown to my app, and what they might mean. Specifically, I need to know
> > whether or not the stored procedure I just ran executed successfully. Is
> > there any place I can look this up?
> >
> > Thanks in advance.
> >
> >
>
>
>
.



Relevant Pages

  • Re: Stored Procedure error is not catched
    ... One of the insert failed but in my java code the SQLException is not thrown. ... You need to add processing after the executeto get all the returns, and then you will get your exception. ... Here is an example which contains the ideal code for processing all the inline returns from any stored procedure. ... boolean getResultSet = ps.execute; ...
    (microsoft.public.sqlserver.jdbcdriver)
  • Re: Help! What is wrong here ?
    ... > getting an SqlException. ... I am using C# in .NET with SQL 2000. ... > Why is is so difficult to pass a filename or location of file to a SPROC? ... Are you sure that the stored procedure is expecting a filename rather ...
    (microsoft.public.dotnet.framework)
  • Re: Job XXX started successfully.
    ... This message is informational and shouldn't raise an exception in your code. ... SQL Server MVP ... The stored procedure simply call the MS SQL system procedure ...
    (microsoft.public.sqlserver.programming)
  • Re: Weird SqlCE Hang Issue
    ... but unfortunately there is no exception ... catch(SqlException), and the generic catch incase a non complaint ... with SQL Compact Edition 3.1. ... before the RDA pull the issue goes away. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Timeout on populating a datagrid
    ... I'd review the stored procedure SQL in a query tool and see how long ... An unhandled exception occurred during the execution of the ... >Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior ...
    (microsoft.public.dotnet.framework.aspnet)

Loading