Skip to Content
Oct 18, 2018 at 11:38 AM

[Crystal Report C# API] How to get exception thrown from Stored Procedure called from Crystal report

1172 Views Last edit Nov 20, 2018 at 05:09 PM 3 rev


I am having troubles trying to retrieve all the exception messages from C# API ReportDocument.ExportToDisk.

Under certain conditions Stored Procedure which is the source of the data for the report throws an exception (MSSQL RAISERROR). When running from Crystal Reports 2008 application several messages are popping up in the following order:

1. Failed to retrieve data from the database.

2. Failed to retrieve data from the database.

3. Database Connector Error: '42000: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server] [TEXT OF THE EXCEPTION FROM STORED PROCEDURE]'

But when running form C# API by calling ReportDocument.ExportToDisk exception is thrown only for the first message (Failed to retrieve data from the database.) and execution stops. Inner exception of this exception does not contain any additional information.

What I need is to get the text of the message from Stored Procedure which is the 3rd message when running from Crystal Report 2008 application.

Crystal Runtime

Windows 10

.Net 4.7


Any advise on the topic is really appreciated.

Thank you.