Peter Chan
asked on
Record not saved and have got no message
Sorry, I change it to be
Hi,
I have the codes within my SP like
Hi,
I have the codes within my SP like
...
begin try
insert into ...
end try
begin catch
select @ErrorMessage=ERROR_MESSAGE();
if @@TRANCOUNT>0
begin
rollback tran
set @message='...'
return
end
end catch
if @@TRANCOUNT>0
begin
commit tran
set @message='...'
end
...
but I do get no message returned and no record has been saved, while I did see @@TRANCOUNT is having the value of 2, right before the last "if" part. why?
ASKER
If I remove Try ... catch above, I don't see any error message but the record is not saved as well.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What is the error message that you are expecting? Try removing the TRY.. CATCH and see what error is thrown.
-Harish