2010-04-06 99 views

回答

0

我认为Crystal Report很早以前就与VS进行了整合。即使工具箱中显示了一个报告选项卡,如何使用它,只需将添加项目选项中的Crystal Report文件添加到项目中,然后按照向导。

如何将其绑定到你的网站也simple.Add Crystal报表视图控件工具箱从在你的web form.Then做

protected void Page_Load(object sender, EventArgs e) 
    { 
     ReportDocument document = CreateReportDocument("MyReportFile");    
     CrystalReportViewer1.ReportSource = document; 
    } 

    public static ReportDocument CreateReportDocument(string crystalReportName) 
    { 
     ReportDocument crdocument = new ReportDocument(); // Report document variable 
     string reportfile = ConfigurationManager.AppSettings["CrystalReportFilePath"].ToString() + "\\" + crystalReportName + ".rpt";    
     try 
     {     
       DataTable report = new Datatable(); // You should put your data here 
       crdocument.Load(reportfile);// Load the report being displayed 
       crdocument.Database.Tables[0].SetDataSource(report);   
     } 
     catch (Exception exception) 
     { 
      throw exception; 
     } 
     return crdocument; 
    } 
+0

我看不出有任何的Crystal Reports选项卡在工具箱中,并且它也不在项目的“添加新项目”对话框中。 – 2010-04-06 19:59:16

+0

还有一个报告选项卡,其中也包含Microsoft报告查看器。对我而言,它在AJAX扩展和HTML之间。 – Steve 2010-04-06 20:24:14

+0

@ Steve.Thank纠正我。我应该在报告标签和@Ryan Shripat中说,只要我知道他们整合,因为我知道VS 2003。 – wonde 2010-04-07 01:35:22

相关问题