Reporting services 尚未指定报表定义的源
我得到以下错误Reporting services 尚未指定报表定义的源,reporting-services,Reporting Services,我得到以下错误 the source of report definition has not been specified 这是我正在使用的代码 ReportViewer ReportViewer1 =null; ReportPath = "Reports/BatchOtherComments.rdlc"; ... rptData.DataSetName = "spReport_LoanSummaryBatchOther"; objReportDataSou
the source of report definition has not been specified
这是我正在使用的代码
ReportViewer ReportViewer1 =null;
ReportPath = "Reports/BatchOtherComments.rdlc";
...
rptData.DataSetName = "spReport_LoanSummaryBatchOther";
objReportDataSource = new ReportDataSource("spReport_LoanSummaryBatchOther", rptData.Tables[0]);
rep.DataSources.Add(objReportDataSource);
Warning[] warnings;
string mimeType;
string encoding;
string extension;
string deviceInfo;
string[] streamids;
deviceInfo =
"<DeviceInfo>" +
" <OutputFormat>PDF</OutputFormat>" +
" <PageSize>A4</PageSize>" +
" <PageWidth>8.5in</PageWidth>" +
" <PageHeight>11in</PageHeight>" +
" <MarginTop>0.25in</MarginTop>" +
" <MarginLeft>0.25in</MarginLeft>" +
" <MarginRight>0.25in</MarginRight>" +
" <MarginBottom>0.25in</MarginBottom>" +
"</DeviceInfo>";
byte[] bytes = ReportViewer1.ServerReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings);
FileStream fs = new FileStream(@"C:/Users/wnaeem/Sample.PDF", FileMode.Create);
fs.Write(bytes, 0, bytes.Length);
fs.Close();
}
}
catch (Exception ex)
{
throw ;
}
finally
{
ReportViewer1.Dispose();
}
reportviewerreportviewer1=null;
ReportPath=“Reports/BatchOtherComments.rdlc”;
...
rptData.DataSetName=“spReport\u LoanSummaryBatchOther”;
objReportDataSource=newreportdatasource(“spReport_LoanSummaryBatchOther”,rptData.Tables[0]);
rep.DataSources.Add(objReportDataSource);
警告[]警告;
字符串模拟类型;
字符串编码;
字符串扩展;
字符串设备信息;
字符串[]流线;
设备信息=
"" +
“PDF”+
“A4”+
“8.5英寸”+
“11英寸”+
“0.25英寸”+
“0.25英寸”+
“0.25英寸”+
“0.25英寸”+
"";
byte[]bytes=ReportViewer1.ServerReport.Render(“PDF”、null、out-mimeType、out-encoding、out-extension、out-streamid、out-warnings);
FileStream fs=newfilestream(@“C:/Users/wnaeem/Sample.PDF”,FileMode.Create);
fs.Write(字节,0,字节.长度);
fs.Close();
}
}
捕获(例外情况除外)
{
投
}
最后
{
ReportViewer1.Dispose();
}
请注意,您可以编辑您的问题,使其更具可读性,从而使其更有趣,从而更有可能得出答案。除此之外,我看不出您的问题?您没有在代码中设置ReportPath,因此会出现一个错误,即报告尚未设置。这就是你所期望的,对吗?