cancel
Showing results for 
Search instead for 
Did you mean: 

Does anyone know how to set a timeout on the database call the report viewer makes when loading the rpt file?

Former Member
0 Kudos

I have a web app that has a crystal reports viewer that executes rpt files. The data in the rpt files are populated with a stored procedure that runs on a sql database. The crystal report viewer is the latest version. On .net framework version 4.5. The rpt files are created in crystal reports 2013. We have a case when an end user generated the a rpt file, the stored procedure gets a bad query plan, and just runs and runs on our database server until our db administrator sees it and manually cancels it. Even after the end user has closed the viewer. My question is does anyone know of a way I can set a timeout on the data call the report viewer executes? I can not set a global timeout on SQL batch types because our application has other processes that need a longer timeout property than the crystal report does. I have explored CrystalDecisions.Shared.ConnectionInfo options and haven't had any success. If there is not a way to set a specific timeout on the viewer.. is there a way to change the event type the stored procedure is executed as to RPC? Thanks in advance for your responses.

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

Hi Bill

There is no CR API that would control a time out on a database connection. Best I can think of is your own routine that would allow the user to close the report and the viewer ( .close, .dispose) when they think it is taking too long for the report to come back.

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow us on Twitter

Former Member
0 Kudos

Thanks for the response. I appreciate your suggestion, but we are still looking for a way to protect our database in the case where the user doesn't property hit the close. I am curious to know what the "Connect Timeout" and the "General Timeout" properties do? I tried setting them to 1 and tried the report to a data set that was taking a minute and half to execute expecting the report to stop.

0 Kudos

Hi Bill,

CR SDK does not have the ability to use Async connection property like CR Designer does. In CRD you can hit the Stop button and this will send a command to the Server to stop processing the SQL requested by CRD and the report will process what data it has.

The problem is when the SDK starts to process the report, control is removed from the application. This is true when Previewing, Exporting or Printing. You have no control once the report starts executing. You can click on your Form and nothing happens, only way to stop is to kill the exe in Task Manager.

If you are using a Dataset however the data is collected before CR starts to process it so you may be able to send a cancel Command to the Server before you set the data source to the report.

A quick Google search found this:

http://msdn.microsoft.com/en-us/library/hh211418(v=vs.110).aspx

You may have to expand on that page and figure out how to send the stop command but if you figure it out then you can test if the process is taking more than 5 minutes then stop the SQL for your DS and handle it so you jump out of the routine before CR gets the DS assigned to it.

Pop up a message box indicating you amount of data is too much and to add filtering to reduce the amount returned.

Don

Answers (0)