唯一的出路。正如罗萨多建议的那样。一点解释1.创建一个RPT文件。2.使用所需的列创建一个XSD。3.将列拖放到rpt上。根据需要对其进行格式化。4.现在创建连接,使用适配器填充该数据集。5.填充数据集将自动填充报告列。
下面是一个矿山项目的示例代码。
Invoice invoice = new Invoice(); // instance of my rpt filevar ds = new DsBilling(); // DsBilling is mine XSDvar table2 = ds.Vendor;var adapter2 = new VendorTableAdapter();adapter2.Fill(table2);var table = ds.Bill;var adapter = new BillTableAdapter();string name = cboCustReport.Text;int month = int.Parse(cboRptFromMonth.SelectedItem.ToString());int year = int.Parse(cboReportFromYear.SelectedItem.ToString());adapter.Fill(table, name,month,year);ds.AcceptChanges();invoice.SetDataSource(ds);crystalReportViewer1.ReportSource = invoice;crystalReportViewer1.RefreshReport();



