怎样给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);
}
网易云信
2023-12-06 广告
2023-12-06 广告
UIkit是一套轻量级、模块化且易于使用的开源UI组件库,由YOOtheme团队开发。它提供了丰富的界面元素,包括按钮、表单、表格、对话框、滑块、下拉菜单、选项卡等等,适用于各种类型的网站和应用程序。UIkit还支持响应式设计,可以根据不同...
点击进入详情页
本回答由网易云信提供
展开全部
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();
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询