views:

26

answers:

1

I'm trying to use the ServerReport.RenderStream method from the ASP.NET ReportViewer (2008 SP1), but I'm getting a rsStreamNotFound exception from the method. I've tried the two different lines of code below after setting the parameters. I'm interfacing with SQL Server 2005 and SSRS 2005. I've seen articles about a hotfix for this issue, but I'd really rather not resort to a hotfix, as I'm not sure that IT will be OK with it going in. There isn't too much documentation that I've found on the error which is

The stream cannot be found. The stream identifier that is provided to an operation cannot be located in the report server database.report server database.

Prep Code:

string mimeType;
string encoding;
List<ReportParameter> parameters = new List<ReportParameter>();
string startDateValue = Request.Form[startDate.UniqueID];

string endDateValue = Request.Form[endDate.UniqueID];
parameters.Add(new ReportParameter("Owner", "5", false));
parameters.Add(new ReportParameter("StartDate", startDateValue, false));
parameters.Add(new ReportParameter("EndDate", endDateValue, false));
ReportViewer1.ServerReport.SetParameters(parameters);

Call 1:

byte[] result = ReportViewer1.ServerReport.RenderStream("PDF", string.Empty, string.Empty, out mimeType, out encoding);

Call 2:

byte[] result = ReportViewer1.ServerReport.RenderStream("CSV", string.Empty, string.Empty, out mimeType, out encoding);

Clean up:

Response.Clear();
Response.ContentType = mimeType;
Response.ContentEncoding = System.Text.Encoding.GetEncoding(encoding);
Response.OutputStream.Write(result, 0, result.Length);

Any thoughts on a solution? The end goal is to write this out to CSV for a download. In reality I'd be happy with XML that I'd translate to CSV.report server database.

A: 

Yep, the Render method does exactly what I want it to do. I'd love to hear from someone that has experience on RenderStream though.

MasterMax1313