Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3316

Re: Crystal Reports(Support Pack 14) Print and Export

$
0
0

Hi Don:

 

the code like this,Set the parameter values first and then log on,but it does not work

--------------------------------------------------------------------------------------------------

   protected void Page_Load(object sender, System.EventArgs e)
        {
            this.Response.Expires = 0;
            Hashtable HTConn = new Hashtable();
            string ServerName = "gea-nb-davi";
            string DataBaseName = "v36";
            string UID = "sa";
            string PWD = "sa";
 

            string FilePath = Server.MapPath(@"RPT\" + Request.QueryString["REPORTID"] + ".rpt");
            m_ReportId = Request.QueryString["REPORTID"];
          
            CRWithClose RD = new CRWithClose(this);
            RD.Load(FilePath);

            Hashtable hsParaList=null;
            if (Session["CRYSTALREPORTUSERDEFINEDPARALIST"] != null)
            {
                hsParaList = (Hashtable)Session["CRYSTALREPORTUSERDEFINEDPARALIST"];
            }

            for (int i = 0; i < RD.DataDefinition.ParameterFields.Count; i++)
            {
                ParameterFieldDefinition PFD = RD.DataDefinition.ParameterFields[i];
                if (PFD.CurrentValues != null)
                {
                    PFD.CurrentValues.Clear();
                }
                if (PFD.DefaultValues != null)
                {
                    PFD.DefaultValues.Clear();
                }
                if (PFD.Name.ToUpper() == "PARADEPTIDFOREHR")
                {
                    if (Session["IsUseDeptForeHR"] != null && Session["IsUseDeptForeHR"].ToString().ToUpper() == "TRUE")
                    {
                        string[] larrDeptID = (string[])Session["DeptIDForeHR"];
                        string DID = larrDeptID[0];
                        RD.SetParameterValue(PFD.Name.ToUpper(), DID);
                    }
                }

                if (hsParaList != null)
                {
                    if (hsParaList.Count > 0 && hsParaList.ContainsKey(PFD.Name))
                    {
                        RD.SetParameterValue(PFD.Name.ToUpper(), hsParaList[PFD.Name].ToString().Trim());
                    }
                }
            }

            ConnectionInfo CI = new ConnectionInfo();
            CI.ServerName = ServerName;
            CI.DatabaseName = DataBaseName;
            CI.UserID = UID;
            CI.Password = PWD;

            RD.Database.Tables[0].LogOnInfo.ConnectionInfo = CI;

            RD.Database.Tables[0].ApplyLogOnInfo(RD.Database.Tables[0].LogOnInfo);


            crv1.ReportSource = RD;
            crv1.HasToggleParameterPanelButton = false;
            crv1.HasToggleGroupTreeButton = false;
            crv1.EnableParameterPrompt = true;
            crv1.HasExportButton = true;
            crv1.HasPrintButton = true;
            crv1.HasRefreshButton = false;
            crv1.HasDrillUpButton = false;

            crv1.PrintMode = CrystalDecisions.Web.PrintMode.ActiveX;
            crv1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;
        }

--------------------------------------------------------------------------------------------------------------------------


Viewing all articles
Browse latest Browse all 3316

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>