C# 处理本地报表时出错
我不明白为什么我在处理本地报告时会出现这个错误 我的密码是这个C# 处理本地报表时出错,c#,reportviewer,localreport,C#,Reportviewer,Localreport,我不明白为什么我在处理本地报告时会出现这个错误 我的密码是这个 rdlFilename = "IFG Renew Initial_allinone.rdlc"; //try //{ string ConnectionString = ""; SOAReportViewer.Reset();
rdlFilename = "IFG Renew Initial_allinone.rdlc";
//try
//{
string ConnectionString = "";
SOAReportViewer.Reset();
SOAReportViewer.ProcessingMode = ProcessingMode.Local;
List<ReportParameter> paramList = new List<ReportParameter>();
paramList.Add(new ReportParameter("SOANumber", sSOA));
paramList.Add(new ReportParameter("NotedBy", sNotedBy));
SOAReportViewer.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local;
SOAReportViewer.LocalReport.ReportPath = @"C:\IFG_REPORT_FILE\" + rdlFilename; //"BankAdvice.rdlc";
SOAReportViewer.LocalReport.EnableHyperlinks = true;
SOAReportViewer.LocalReport.SetParameters(paramList);
SOAReportViewer.LocalReport.DataSources.Clear();
Billing.SOA = sSOA;
Billing.NotedBy = sNotedBy;
dsSOAreport = Billing.GET_SP_MAXI_SOA_IFG_Cover_Letter_Renew();
dtSOAreport = dsSOAreport.Tables[0];
ConnectionString = "ds_IFG_Family_Renew";
SOAReportViewer.LocalReport.DataSources.Add(new ReportDataSource(ConnectionString, dtSOAreport));
SOAReportViewer.LocalReport.Refresh();
Microsoft.Reporting.WinForms.Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string extension;
byte[] writeBinaryBytes = new byte[0];
byte[] writeBinaryBytes2 = new byte[0];
string deviceInfo = "<DeviceInfo>" +
" <OutputFormat>PDF</OutputFormat>" +
" <PageWidth>8.5in</PageWidth>" +
" <PageHeight>8.5in</PageHeight>" +
" <MarginTop>1in</MarginTop>" +
" <MarginLeft>0.2in</MarginLeft>" +
" <MarginRight>0.2in</MarginRight>" +
" <MarginBottom>0.5in</MarginBottom>" +
" <HumanReadablePDF>True</HumanReadablePDF>" +
"</DeviceInfo>";
sFilename = @"C:\IFG_REPORT_FILE\PDF\" + sSOA.Trim() + ".PDF";
writeBinaryBytes = SOAReportViewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings);
^-- Exception on this code that says "An error occurred during local report processing."
using (FileStream stream = File.OpenWrite(sFilename))
{
stream.Write(writeBinaryBytes, 0, writeBinaryBytes.Length);
stream.Flush();
stream.Close();
}
rdlFilename=“IFG续订初始\u allinone.rdlc”;
//试一试
//{
字符串连接字符串=”;
SOAReportViewer.Reset();
SOAReportViewer.ProcessingMode=ProcessingMode.Local;
List paramList=新列表();
添加(新报告参数(“SOANumber”,sSOA));
添加(新报告参数(“NotedBy”,sNotedBy));
SOAReportViewer.ProcessingMode=Microsoft.Reporting.WinForms.ProcessingMode.Local;
SOAReportViewer.LocalReport.ReportPath=@“C:\IFG_报告_文件\”+rdlFilename;/“BankAdvice.rdlc”;
SOAReportViewer.LocalReport.EnableHyperlinks=true;
SOAReportViewer.LocalReport.SetParameters(paramList);
SOAReportViewer.LocalReport.DataSources.Clear();
Billing.SOA=sSOA;
Billing.NotedBy=sNotedBy;
dsSOAreport=计费。获取最大金额的保险单(如果保险单上有保险单的话)和续费单(如果续费的话);
dtSOAreport=dsSOAreport.Tables[0];
ConnectionString=“ds\u IFG\u Family\u续订”;
SOAReportViewer.LocalReport.DataSources.Add(新的ReportDataSource(ConnectionString,dtSOAreport));
SOAReportViewer.LocalReport.Refresh();
Microsoft.Reporting.WinForms.Warning[]警告;
字符串[]流线;
字符串模拟类型;
字符串编码;
字符串扩展;
byte[]writeBinaryBytes=新字节[0];
字节[]writeBinaryBytes2=新字节[0];
字符串deviceInfo=“”+
“PDF”+
“8.5英寸”+
“8.5英寸”+
“1英寸”+
“0.2英寸”+
“0.2英寸”+
“0.5英寸”+
“对”+
"";
sFilename=@“C:\IFG\U报告文件\PDF\”+sSOA.Trim()+“.PDF”;
writeBinaryBytes=SOAReportViewer.LocalReport.Render(“PDF”,null,输出mimeType,输出编码,输出扩展名,输出StreamID,输出警告);
^--此代码上的异常表示“本地报表处理过程中发生错误”
使用(FileStream-stream=File.OpenWrite(sFilename))
{
Write(writeBinaryBytes,0,writeBinaryBytes.Length);
stream.Flush();
stream.Close();
}
我不知道是什么问题,为什么会出现此错误。我在其他报告中有相同的代码,并且它正在工作。您能在这一方面帮助我吗?伙计们,提前谢谢。您的RDL文件名和路径正确吗?文件名中的下划线不一致。@br4d是的,它是正确的。这是
rdlc
中的一般错误;请尝试catchi查看异常
,并查看内部异常
的各个级别(即:ex.Message
、ex.InnerException.Message
、ex.InnerException.InnerException.Message
等),为我们提供更多信息。