如何按会话ID构建Crystal Report? [英] How to build Crystal Report by Session ID?

查看:43
本文介绍了如何按会话ID构建Crystal Report?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。



我有问题和疑问。我有一份使用CR 2013软件制作的Crystal报表。我的数据来自SQL服务器。然后我将报告添加到我的Web项目中,添加了一个新的Web表单,添加了一个文本框并在web表单中添加了crystalreportviewer。报告显示在观众中。这是我在网页表格上的代码,上面有CRV。



Hello All.

I have an issue and question. I have a Crystal Report that I made using the CR 2013 Software. My data comes from an SQL server. I then added the report to my web project, added a new web form, added a textbox and added crystalreportviewer to the web form. The report shows in the viewer. This is the code I have for the web form with the CRV on it.

using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using CrystalDecisions.Web;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.WebControls;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Xml.Linq;
using System.Web.SessionState;


namespace SACSCOCLogin1._1
{
    public partial class ReportFormA : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            TextBoxINST_ID.Text = Session["inst_id"].ToString();
            CrystalReportViewer1.Visible = true;
            ReportDocument crystalReport = new ReportDocument();
            crystalReport.Load(Server.MapPath("~/Reports/ReportA.rpt"));
            crystalReport.SetDatabaseLogon
            ("Admin", "home22", @"SQL", "Hot");
            CrystalReportViewer1.ReportSource = crystalReport;
            CrystalReportViewer1.SelectionFormula = "{COCINST.inst_id} = '" + Session["inst_id"].ToString() + "'";
            
        }





为什么不工作?如何使用会话中的用户ID将其修复到构建报表的位置?



Why is it not working? How can I fix it to where the report is built using the users ID that is in a session?

推荐答案

已在CodeProject中回答。

看看那里;)

如何从会话中创建水晶报告 [ ^ ]
Already answered in CodeProject.
Take a look there ;)
how to create crystal report from session[^]


这篇关于如何按会话ID构建Crystal Report?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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