W
William F. Robertson, Jr.
One of my developers came to me with this question and I don't have an
answer for them. The only suggestion I had for them was to change the
return to a output parameter and put a try catch around it and look for the
output parameter to have a value.
I would have thought this should have been posted in the sql newgroups, but
I know exactly what they would say, and they would be correct.
But when using asp.net ado.net command object. I am running a sproc that
handles its own errors gracefully and will sets the output parameter @msg to
a successful, or unsucessful message.
And it does return it when I run the sproc in query analyzer.
However, when I run the code in asp.net the Execute method for the Command
object throws and exception so I never get the status.
Is there a way in a stored procedure to clear the error so it doesn't
through an exception through the ado.net object?
bill
<sproc snippet>
Insert Into tblTPA
Values( @FinalID, GetDate(), @InAuditor, @Type, @Comments, @Hours,
@Expenses, @DinersExpenses)
if @@Error <> 0
BEGIN
ROLLBACK
Set @msg = 'The final timesheet you tried to save was already saved by
another user.'
END
else
BEGIN
COMMIT
Set @msg = 'The final timesheet has been saved.'
END
Select @msg
answer for them. The only suggestion I had for them was to change the
return to a output parameter and put a try catch around it and look for the
output parameter to have a value.
I would have thought this should have been posted in the sql newgroups, but
I know exactly what they would say, and they would be correct.
But when using asp.net ado.net command object. I am running a sproc that
handles its own errors gracefully and will sets the output parameter @msg to
a successful, or unsucessful message.
And it does return it when I run the sproc in query analyzer.
However, when I run the code in asp.net the Execute method for the Command
object throws and exception so I never get the status.
Is there a way in a stored procedure to clear the error so it doesn't
through an exception through the ado.net object?
bill
<sproc snippet>
Insert Into tblTPA
Values( @FinalID, GetDate(), @InAuditor, @Type, @Comments, @Hours,
@Expenses, @DinersExpenses)
if @@Error <> 0
BEGIN
ROLLBACK
Set @msg = 'The final timesheet you tried to save was already saved by
another user.'
END
else
BEGIN
COMMIT
Set @msg = 'The final timesheet has been saved.'
END
Select @msg