How to find the error number?

How to find the error number?

Old forum URL: forums.lhotka.net/forums/t/2082.aspx


RangerGuy posted on Friday, January 05, 2007

How do I dig out the Error Number from DataPortalException that is returned from SQL Server?

RockfordLhotka replied on Friday, January 05, 2007

DataPortalException.BusinessException should get you to the original exception that caused the failure. Most likely that is your SqlException, which would contain everything there is to know about that exception.

If the error number you are looking for isn't directly in the SqlException object then you might need to catch the exception in your DataPortal_XYZ method and wrap it in a custom exception of your own creation that does contain all the information you need. Then throw your custom exception, which would then be available on the client through DataPortalException.BusinessException.

Copyright (c) Marimer LLC