views:

490

answers:

3

I have now found a TON of crappy not clear, not relevant examples of ways I can start to tackle the problem. Can't believe i've spent any more than 10 minutes on this but it's been 3 hours so far.

I am looking at an aspx page with next to no code behind. This page renders a crystal report out to a pdf.

The crystal report is bound to an objectdatasource which is bound to one of the tableadapters in a stupidly large dataset.

The problem is the query times out. It's a long running proc, (50 seconds) and timeout is 30 seconds. I have looked at adding a partial class but since the objects are not bound in code i wouldn't be able to set the timeout that way and it's a web site and as such the code behind for the dataset is a whole bunch of XML anyway and i'm not sure I can add a partial class here to expose the time out and if I could i'd be repeating about 70 times, once per adapter.

So does anyone have a better, simpler or at least a method that works so I can get this crystal report, today :)

Thanks

A: 

Can't you increase the ConnectionTimeout of the SQLCOnnection used to fill the dataset?

i.e. SQlConnection.ConnectionTimeout = somevalue

Colin
No sorry its not the connection timing out its the command object embedded into the dataset that is generated automatically, its set to 30 and it's not exposed so that you can change it.
Robert
A: 

There are two possibilities: Optimize the procedure or increase your connection timeout.

I know you said it's the command timing out, but I'd bet that it's the connection to the database that is timing out. I've never heard of the command object timing out.

Have you tried changing/setting the time out in the connection string?

Chuck Conway
Command timeouts and connection timeouts are separate, the connection timeout is 300 seconds. You've probably use SQL Management Studio and found you can execute a stored proc via the gui which timeouts but your connection is still open. Same principle here, also if you called the proc via the command line it doesn't timeout as the timeout does not apply there, it applies via the gui window though as it uses a similar command object. Same thing happens if you use the designer remotely to change a table structure, if you use sql commands instead it doesn't timeout. Connection is not relevant
Robert
Thanks for the detailed explanation, I never had any reason to think that CommandTimeout was any different than ConnectionTimeout.
Chuck Conway
A: 

If you can't modify the TableAdapter's timeout, and assuming the procedure can't run any quicker, then i don't see any option other than to set the report's data source to the stored procedure directly. Crystal doesn't really care about timeouts that low.

CodeByMoonlight
I added the partial class and exposed the command timeout. Changed the aspx so the report was not bound at this stage and instead bound it in the page load after making the call to the data myself, setting the timeout to 300 seconds in the code behind first.
Robert