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

VS2005下的水晶报表问题

大家在VS2005下怎么用水晶报表打印的?
我用的Crystal Report10.2...,winForm中拖入一个CrystalReportView控件,能build过去,但是当加载改Form时,运行到
this.crView = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
时,就报:
  System.TypeInitializationException was unhandled
  Message="The type initializer for 'CrystalDecisions.ReportSource.ReportSourceFactory' threw an exception."
  Source="CrystalDecisions.Windows.Forms"
  TypeName="CrystalDecisions.ReportSource.ReportSourceFactory"
  StackTrace:
       at CrystalDecisions.Windows.Forms.CrystalReportViewer..ctor()
       at yike.ui.produce.frmDrawBillView.InitializeComponent() in C:\YiKe\yike\ui\produce\frmDrawBillView.Designer.cs:line 34
我搜了一下,似乎这个是本身就有的问题,大家在VS2005下怎么用水晶报表的?

一天内提供解决方案,立刻给分。多谢
--------------------编程问答-------------------- 为什么要this.crView = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
这句代码?
水晶报表两种模式,楼主可以试试Push模式~~~ --------------------编程问答-------------------- 学习中~~
友情UP --------------------编程问答-------------------- 学习中。。。 --------------------编程问答-------------------- 学习中。。。 --------------------编程问答-------------------- 你拖入控件了嘛!直接用了啊!还NEW什么呢?
 public Form2(ReportClass ff)
        {
            InitializeComponent();
            this.crystalReportViewer1.ReportSource=ff;
        } --------------------编程问答-------------------- 你要NEW的是报表文件,不是你拖的控件! --------------------编程问答-------------------- string hc = "select * from test";
            DataTable dd=new DataTable();
            dd = GetDs(hc);
            Cr1 cr = new Cr1();
            cr.SetDataSource(GetDs(hc));
            this.crystalReportViewer1.ReportSource = cr;   --------------------编程问答-------------------- 是不是动态加载CrystalReportViewer控件?刚才没看清楚?
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,