我可以在Rdlc报告的地方使用Crystal报告到Asp.Net Web应用程序,动态数据集来自文件后面的代码吗? [英] Can I Use Crystal Reports At The Place Of Rdlc Report Into Asp.Net Web Application With Dynamic Dataset From Code Behind File ?

查看:44
本文介绍了我可以在Rdlc报告的地方使用Crystal报告到Asp.Net Web应用程序,动态数据集来自文件后面的代码吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在Place of rdlc报告中使用Crystal Reports进入asp.net Web应用程序,其中包含来自代码隐藏文件的动态数据集。如果有可能请指导我如何将水晶报告用于visual studio并生成报告使用来自代码隐藏文件的动态数据集到asp.net。

can i use Crystal Reports at the Place of rdlc report into asp.net web application with dynamic dataset from code behind file .if this is possible this please guide me how this can be possible to use crystal reports into visual studio and generate report using dynamic dataset from code behind file into asp.net .

推荐答案

step 1:
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using CrystalDecisions.Web;
using CrystalDecisions.ReportSource;

step 2:
//*****paste code button click event...
ReportDocument rptDoc = new ReportDocument();
rptDoc.Load(Server.MapPath(@"xyz.rpt"));
rptDoc.SetDataSource(ReportData());
 rptDoc.SetParameterValue("@nSalaryNumber", txtSalaryNo.Text.ToString());

CrystalReportViewer1.ReportSource = rptDoc;
CrystalReportViewer1.DataBind();
**********//

step 3:
 public DataTable ReportData()
        {
            cmd.CommandText = "SP_GetEmployeesInfo";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@nSalaryNumber", txtSalaryNo.Text);

            cmd.Connection = con;
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            da.Fill(dt);
            return dt;
        }


这篇关于我可以在Rdlc报告的地方使用Crystal报告到Asp.Net Web应用程序,动态数据集来自文件后面的代码吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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