怎样给reportViewer报表组件指定数据源?
展开全部
// <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-08-15 广告
2023-08-15 广告
通常情况下,我们会按照结构模型把系统产生的数据分为三种类型:结构化数据、半结构化数据和非结构化数据。结构化数据,即行数据,是存储在数据库里,可以用二维表结构来逻辑表达实现的数据。最常见的就是数字数据和文本数据,它们可以某种标准格式存在于文件...
点击进入详情页
本回答由光点科技提供
展开全部
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();
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询