我的ReportViewer没有显示任何内容

时间:2014-06-25 03:59:40

标签: c# rdlc

我正在尝试使用ViStud 2010中的C#在Windows应用程序上进行报告。 我在http://cybarlab.com/create-rdlc-report阅读了教程,而我的ReportViewer并没有显示任何内容。我将代码附在显示报告的按钮上。

    DataSet1TableAdapters.contohReportTableAdapter ta = new DataSet1TableAdapters.contohReportTableAdapter();
            DataSet1.contohReportDataTable dt = new DataSet1.contohReportDataTable();
            ta.Fill(dt, Decimal.Parse(textBox1.Text), Decimal.Parse(textBox2.Text));
            ReportDataSource rds = new ReportDataSource();
            rds.Name = "DataSet1";
            rds.Value = dt;

            ReportParameter rp1 = new ReportParameter("pnCBALmin", textBox1.Text.ToString());
            ReportParameter rp2 = new ReportParameter("pnCBALmax", textBox2.Text.ToString());

            //var reportStream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("Report1.rdlc");
            //reportViewer1.LocalReport.LoadReportDefinition(reportStream);

            reportViewer1.LocalReport.DataSources.Clear();
            reportViewer1.LocalReport.ReportPath = "Report1.rdlc";
            reportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp1, rp2 });
            reportViewer1.LocalReport.DataSources.Add(rds);
            reportViewer1.LocalReport.Refresh();

感谢您的帮助

0 个答案:

没有答案