水晶与2个不同的数据集如何 [英] crystal with 2 different dataset how

查看:112
本文介绍了水晶与2个不同的数据集如何的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以合并通过会话数据传递的2个不同的数据集?
我想将其显示为单个水晶报表中的按钮,如何?

我有grid1和grid2在buttonclick上显示数据,并且我需要在水晶报表中显示数据.

Is it possible to combine 2 different datasets passed through sessions data?
I want to show that as button into a single crystal report, how?

I have grid1 and grid2 showing data on buttonclick and in the same way I need to show this in crystal report.

推荐答案

您可以将2个数据集存储在2个会话中, ;检查然后分配给报告,仅此而已.
You can store the 2 datasets in 2 sessions & check then assign to report, That''s all.
protected void BtnGenerateReport_Click(object sender, EventArgs e)
{
    ReportDocument myReportDocument = new ReportDocument();
    myReportDocument.Load(Server.MapPath("\\test.rpt");

    if(Session["DataSet1"] != null)
        {
            DataSet rptDs1 = (DataSet)Session["DataSet1"];
            myReportDocument.SetDataSource(rptDs1);
        }
        else if (Session["DataSet2"] != null)
        {
            DataSet rptDs2 = (DataSet)Session["DataSet2"];
            myReportDocument.SetDataSource(rptDs2);
        }
        CrystalReportViewer1.ReportSource = myReportDocument;
        CrystalReportViewer1.DataBind();
        CrystalReportViewer1.EnableDrillDown = true;
}

,希望它能解决您的问题.

I hope it will resolve your issue.


这篇关于水晶与2个不同的数据集如何的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆