I am trying to catch a SqlException on a SSRS report and display it on a pop-up. So far I have not been able to find this configuration on Report Builder and I thought maybe adding some code on the Code section of the report. Please note that I am not trying to render a report from a remote location, but only continue to render the current report.

A little more context: the SSRS report connects to SQL server on the same host, and executes a stored procedure that may throw an error when invalid input is provided. By default SSRS will output the error on the report itself and nothing else. I think it will be more intuitive for my end user to have the error displayed as a pop-up and not in the report. Microsoft has this article but it is not too descriptive as I wish: https://docs.microsoft.com/en-us/sql/reporting-services/report-server-web-service-net-framework-exception-handling/best-practices/using-try-and-catch-blocks

some tentative source could be:

public void RenderReport(param1, param2){
    try {
        execute current report ...
    catch (SqlException e) {
        MessageBox.Show(e.Message); // could be an alert instead, not really sure ..

Not sure if I am just over complicating this ... Can somebody help me to figure out this?

  • I am not sure how exactly you are trying to handle your error.your tentative code seem ok.use try exception in SP also and return input/flag accordingly from SP.depending upon input show MessageBox from both your Try block and catch block. – KumarHarsh Oct 25 '17 at 5:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.