RDLC 보고서를 만들었으며 웹 브라우저에서 RDLC 보고서를 표시 할 때 문제가 없습니다. 하지만 제 클라이언트는 이제 웹 브라우저에서 보고서를 보여주는 대신 PDF 파일을 브라우저/클라이언트로 보내길 원합니다. 나는 뒤에 코드를 추가하여 보고서의 PDF를 작성하여 클라이언트/브라우저로 보낼 때 오류가 발생합니다. 다음은 클라이언트/브라우저에 PDF를 보내 내 코드입니다 :RDLC 보고서 오류 : Microsoft.ReportingServices.ReportProcessing.ReportProcessingException
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetData"
TypeName="CourrierExpress.ExpressCourierDataSetTableAdapters.uspFrontEnd_Invoice_PrintInvoiceTableAdapter"
OldValuesParameterFormatString="original_{0}">
<SelectParameters>
<asp:QueryStringParameter Name="InvoiceId" QueryStringField="InvoiceId" Type="Int64"
DefaultValue="" />
</SelectParameters>
</asp:ObjectDataSource>
내가 페이지로드에 뒤에이 코드를 호출하고 있습니다 :
Int64 invoiceId = int.Parse(Request.QueryString["InvoiceId"]);
Warning[] warnings;
string[] streamIds;
string mimeType;
string encoding;
string extension;
var rds = new ReportDataSource { DataSourceId = "ObjectDataSource1", Name = "DataSet1" };
var viewer = new ReportViewer();
viewer.ProcessingMode = ProcessingMode.Local;
viewer.LocalReport.DataSources.Clear();
viewer.LocalReport.ReportPath = "Reports/ReportInvoicePrint.rdlc"; //This is your rdlc name.
viewer.LocalReport.DataSources.Add(rds);
var bytes = viewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension,
out streamIds, out warnings);
Response.Buffer = true;
Response.Clear();
Response.ContentType = mimeType;
Response.AddHeader("content-disposition", "attachment; filename= filename" + "." + extension);
Response.OutputStream.Write(bytes, 0, bytes.Length); // create the file
Response.Flush(); // send it to the client to download
Response.End();
RDLC 보고서는 "을 DataSet1"라는 데이터 집합이 있습니다. 오류 스크린 샷은 다음과 같습니다