当前位置:编程学习 > C#/ASP.NET >>

100分紧急求助-RDLC报表——动态加载报表 (报表已经保存为XML,但为什么换不了XML)

100分紧急求助-RDLC报表——动态加载报表 (报表已经保存为XML,但为什么换不了XML  问题: 当每次换报表加载时 提示找不到数据源, 请问怎么清理上次的数据源,加载新的数据源。


代码如下:



string strXML;
            strXML = this.richTextBox1.Text;//获得打印格式 XML
            this.reportViewer1.LocalReport.LoadReportDefinition(this.GenerateRdlc(strXML));//把XML生成报表RDLC
            this.reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("myds_In_Bill", c_ds.Tables[0]));
            this.reportViewer1.LocalReport.Refresh();
            this.reportViewer1.RefreshReport();

第二次加在报表 
 this.reportViewer1.Clear();
            this.reportViewer1.LocalReport.DataSources.Clear();
          //  this.reportViewer1.LocalReport = null;  
            this.reportViewer1.LocalReport.Refresh();
            this.reportViewer1.RefreshReport();
            string strXML;
            strXML = this.richTextBox1.Text;//获得打印格式 XML
            this.reportViewer1.LocalReport.LoadReportDefinition(this.GenerateRdlc(strXML));//把XML生成报表RDLC
            this.reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("myds_IN_Invoice", c_ds.Tables[0]));//myds_IN_Invoice
            this.reportViewer1.LocalReport.Refresh();
            this.reportViewer1.RefreshReport(); --------------------编程问答-------------------- 自己顶 --------------------编程问答-------------------- mark 
up --------------------编程问答-------------------- ok 自己解决了 --------------------编程问答-------------------- 数据源得手动清理!没别的办法! --------------------编程问答-------------------- 怎么解决的啊 --------------------编程问答-------------------- UP起来,Reportviwer现在用的人太少,什么时候能普及起来呀! --------------------编程问答-------------------- 顶起来,怎么解决的呀! --------------------编程问答-------------------- 哎! --------------------编程问答-------------------- 楼主怎么这样,怎么不说一下怎么解决的呢 --------------------编程问答-------------------- --------------------编程问答-------------------- 帮忙UP --------------------编程问答-------------------- LZ您就把代码给大家Show一下吧~
让我们都开开眼界
期待
--------------------编程问答-------------------- 以后需再关注,现在先帮你顶一下 --------------------编程问答-------------------- 哈哈  好久没来了。。。。。。我记得是   有个  report view  有个方法  reset   调用他一下就  搞定了 --------------------编程问答-------------------- 学习~
补充:.NET技术 ,  图表区
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,