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

zhegebucuo 2007-01-10 05:30:56
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();
...全文
649 15 打赏 收藏 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
qmairen0220 2008-09-23
  • 打赏
  • 举报
回复
学习~
zhegebucuo 2008-09-19
  • 打赏
  • 举报
回复
哈哈 好久没来了。。。。。。我记得是 有个 report view 有个方法 reset 调用他一下就 搞定了
huaer1011 2008-03-19
  • 打赏
  • 举报
回复
LZ您就把代码给大家Show一下吧~
让我们都开开眼界
期待
huaer1011 2008-03-19
  • 打赏
  • 举报
回复
帮忙UP
tangren7 2008-03-18
  • 打赏
  • 举报
回复
楼主怎么这样,怎么不说一下怎么解决的呢
lxmfll2000 2007-01-25
  • 打赏
  • 举报
回复
哎!
lxmfll2000 2007-01-24
  • 打赏
  • 举报
回复
顶起来,怎么解决的呀!
lxmfll2000 2007-01-22
  • 打赏
  • 举报
回复
UP起来,Reportviwer现在用的人太少,什么时候能普及起来呀!
v鼠来宝v 2007-01-21
  • 打赏
  • 举报
回复
怎么解决的啊
lxmfll2000 2007-01-17
  • 打赏
  • 举报
回复
数据源得手动清理!没别的办法!
难得胡涂 2007-01-11
  • 打赏
  • 举报
回复
mark
up
zhegebucuo 2007-01-11
  • 打赏
  • 举报
回复
自己顶
zhegebucuo 2007-01-11
  • 打赏
  • 举报
回复
ok 自己解决了

4,818

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 图表区
社区管理员
  • 图表区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧