c#报表出现“尚未为数据源提供数据源实例”解决办法 [转]

制作报表中,因为直接拷来用,然后修改的,出现问题。把表面上能改的,改了之后发现还是没成功,搜到一个好文章解决了。

把name改掉就好了。

 

1、rdlc文件时一个文本文件(只不过vs设计器打开时,是可视化的),用文本编辑器打开查看,有dataset节点,如下所 示,<DataSet Name=”HBQueue_JgdmBean”>,当然,dataset节点可以有多个,没用的可以删除,删除前注意备份,也要确保删除无误。记 住dataset名字。

2、问题出现在form的designer文件中(vs2005以上),不用设计器打开,用文本打开form.designer.cs文件,查看代码,在InitializeComponent方法中有类似如下代码

Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource();
系统自动添加的代码,如果中间改过名字,上述部分可能会出现多个dataSource,

Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource();
Microsoft.Reporting.WinForms.ReportDataSource reportDataSource2 = new Microsoft.Reporting.WinForms.ReportDataSource();

3、再往下看,有如下类似代码

reportDataSource1.Name = “HBQueue_JgdmBean”;
            reportDataSource1.Value = this.JgdmBeanBindingSource;

reportDataSource2.Name = “PrintClient_JgdmBean”;
            reportDataSource2.Value = null; 

            reportView1.LocalReport.DataSources.Add(reportDataSource1);

reportView1.LocalReport.DataSources.Add(reportDataSource2);
问题就出现在上面的代码中,在此不多做解释了,自行处理,则问题解决。

数据传输打通的桥梁也就在这儿了。

4、上面的JgdmBeanBindingSource很简单了,就是一个数据源绑定对象,设定好DataSource属性,即通过vs新建的数据源,一般来说,用数据对象的居多。

5、问题解决的关键就在第2点和第3点。

http://blog.csdn.net/xiaolong85/article/details/5579963

转载于:https://www.cnblogs.com/halo-sc/p/3522817.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值