Wil*_*ill 8 c# reporting-services
我收到了错误
client found response content type of '' but expected 'text xml' The request failed with an empty response.
Run Code Online (Sandbox Code Playgroud)
当我尝试执行以下代码时.
//create a PDF from the SQL report
ReportViewer rview = new ReportViewer();
rview.ServerReport.ReportServerUrl = new Uri("http://server/ReportServer$MSSQL2K5?");
List<ReportParameter> paramList = new List<ReportParameter>();
paramList.Add(new Microsoft.Reporting.WinForms.ReportParameter("Batch", "1"));
paramList.Add(new Microsoft.Reporting.WinForms.ReportParameter("InvoiceNo", "0"));
rview.ServerReport.ReportPath = "Report/Report Invoice";
rview.ServerReport.SetParameters(paramList);
string mimeType, encoding, extension, deviceInfo;
string[] streamids;
Microsoft.Reporting.WinForms.Warning[] warnings;
string format = "PDF"; //Desired format goes here (PDF, Excel, or Image)
deviceInfo =
"<DeviceInfo>" +
"<SimplePageHeaders>True</SimplePageHeaders>" +
"</DeviceInfo>";
byte[] bytes = rview.LocalReport.Render(format, deviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings);
Run Code Online (Sandbox Code Playgroud)
该行发生错误:
rview.ServerReport.SetParameters(paramList);
Run Code Online (Sandbox Code Playgroud)
地址是正确的,因为我可以通过网络浏览器加载报告:
this.webBrowser1.Navigate("http://server/ReportServer$MSSQL2K5?/Report/Report Invoice&Batch=1&InvoiceNo=0");
Run Code Online (Sandbox Code Playgroud)
我需要使用报表查看器加载报表,以便我可以导出为PDF.
尝试将Uri设置为完整服务uri,例如:
new Uri("http://server/ReportServer$MSSQL2K5/reportservice2005.asmx?")
Run Code Online (Sandbox Code Playgroud)
另外,你需要尾随?吗?我不确定,但如果需要的话,不会附加SetParameters吗?