怎样给reportViewer报表组件指定数据源?
2个回答
展开全部
// <summary>
/// 生成报表数据
/// </summary>
private void CreateReport()
{
string bgDate = txtBegin.Text.Trim().Replace("-", "");
string edDate = txtEnd.Text.Trim().Replace("-", "");
DataTable dt = OPReportBLL.GetClientTargetList(ddlYear.SelectedValue + ddlMonth.SelectedValue + ddlWeek.SelectedValue.Substring(0, 1));
this.RptView.LocalReport.ReportPath = "Report\\RptFile\\ADCClientTarget.rdlc";
this.RptView.LocalReport.DataSources.Clear();
this.RptView.LocalReport.DataSources.Add(new ReportDataSource("ADCClientTarget_ADCClientTarget", dt));
this.SetReportParameters(this.RptView.LocalReport);
this.RptView.DataBind();
}
/// <summary>
/// 设置报表参数
/// </summary>
private void SetReportParameters(Report localReport)
{
ReportParameter[] parameters = new ReportParameter[1];
parameters[0] = new ReportParameter("time", "统计区间:" + txtBegin.Text + "至" + txtEnd.Text);
localReport.SetParameters(parameters);
}
/// 生成报表数据
/// </summary>
private void CreateReport()
{
string bgDate = txtBegin.Text.Trim().Replace("-", "");
string edDate = txtEnd.Text.Trim().Replace("-", "");
DataTable dt = OPReportBLL.GetClientTargetList(ddlYear.SelectedValue + ddlMonth.SelectedValue + ddlWeek.SelectedValue.Substring(0, 1));
this.RptView.LocalReport.ReportPath = "Report\\RptFile\\ADCClientTarget.rdlc";
this.RptView.LocalReport.DataSources.Clear();
this.RptView.LocalReport.DataSources.Add(new ReportDataSource("ADCClientTarget_ADCClientTarget", dt));
this.SetReportParameters(this.RptView.LocalReport);
this.RptView.DataBind();
}
/// <summary>
/// 设置报表参数
/// </summary>
private void SetReportParameters(Report localReport)
{
ReportParameter[] parameters = new ReportParameter[1];
parameters[0] = new ReportParameter("time", "统计区间:" + txtBegin.Text + "至" + txtEnd.Text);
localReport.SetParameters(parameters);
}
ZESTRON
2024-09-04 广告
2024-09-04 广告
在Dr. O.K. Wack Chemie GmbH,我们高度重视ZESTRON的表界面分析技术。该技术通过深入研究材料表面与界面的性质,为提升产品质量与可靠性提供了有力支持。ZESTRON的表界面分析不仅涵盖了相变化、化学反应、吸附与解吸...
点击进入详情页
本回答由ZESTRON提供
展开全部
DataSet ds = SQLHelper.Query("SELECT * FROM TABLE");
CrystalReportSource1.ReportDocument.Load(Server.MapPath("01.rpt"));
CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables[0]);
CrystalReportSource1.DataBind();
CrystalReportViewer1.ReportSource = CrystalReportSource1;
CrystalReportViewer1.DataBind();
CrystalReportSource1.ReportDocument.Load(Server.MapPath("01.rpt"));
CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables[0]);
CrystalReportSource1.DataBind();
CrystalReportViewer1.ReportSource = CrystalReportSource1;
CrystalReportViewer1.DataBind();
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询