views:

214

answers:

0

Hello,

I wrote a procedure that compiles many of our invoices using MS SQL Server Reporting Services. The procedure cycles through all the invoices for the month, loads the RDLC file, and renders the report. Note that the report also includes a subreport. The rendered report is then converted to PDF and saved on the disk.

This works fine but is a long process, so I've rewritten the code to do the actual rendering and the heavy lifting in a separate thread so as to not tie up the ASP.NET thread pool that handles the request and also so the page initiating the report will not time out.

I am aware that this means that a new thread is created everytime the report is ran, but I have some functionality in place to keep this out of control and is out of the scope of my question. (Though I'm fully open to suggestions on how to write it)

At first I ran into some problems because I ported the code over almost literally to a new method, and the code was using some properties that were tied to the current context, (such as Request.Path), so I made sure to pass in those as arguments to the method.

However, the problem I'm running into now is that I cannot generate the subreports- they come out as blank. Actually, I think no parameteres are even being passed to the parent report either, since the report that does render any data-bound fields. (So I guess just the dataset is not being passed).

This only occurs when I run the method in a separate thread- If I run it on the same thread it works just fine.

GenReport(rgp);

vs

Thread nt = new Thread(new ParameterizedThreadStart(GenReport));
nt.Start(rgp);

Any thoughts?