Skip to Content
1

How to apply Crystal Reports 2016 license to web application developed with visual studio

Dec 16, 2016 at 05:20 PM

379

avatar image
Former Member

Hello,

I have a web application that my company uses internally it was developed with Visual Studio 2015 and the Crystal Reports included in visual studio. Now we have the problem that after 75 reports the reports stop working, to fix the issue I am thinking to buy Crystal Reports 2016 but I am not sure if this is the correct product to fix the issue and if it is, how do you integrate it on the application? Do you need to recreate reports? or just install Crystal Reports 2016 on my web server and the license will override the development license and I don't need to change anything on my application? Any help will be appreciate it.

Thank you

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

7 Answers

Best Answer
Don Williams
Jan 04, 2017 at 11:46 PM
0

Put it back into the Page unload event so it releases the report object.

Reason the second page doesn't show is because you need to use PostBack to keep the report in scope.

See KBA 1215387 for example also.

Don

Share
10 |10000 characters needed characters left characters exceeded
Dell Stinnett-Christy Dec 19, 2016 at 03:16 PM
0

Crystal Reports 2016 does not provide either the SDK or it's licensing. You can find information about what the SDK license covers here: http://bit.ly/2bnlS6e.

Basically, the runtime licensing allows you to run 5 concurrent reports and up to 100 concurrent print jobs. A print job is your main report any any instances of subreports within it. Each subreport is counted as a print job every time it runs. So, for example, a report with a single subreport in the report header is two print jobs. A report with a single subreport in the details section and 100 records displaying on the report will count as 101 print jobs and will fail.

In your code, are you explicitly calling .Close() and .Dispose() on your reports? If not, you need to. The foundation of the SDK is a set of COM objects and Visual Studio does not memory manage COM very well, hence the need to explicitly call .Dispose().

If that doesn't solve your problem, you'll need to look at getting licenses for Crystal Reports Server 2016 in order to resolve the issue.

-Dell

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Dec 22, 2016 at 08:56 PM
0

Hello Dell,

Sorry for the delayed response. I have tried to use close() and dispose() but it doesn't work, in the same screen a user can run reports with different parameters and when I add the close() and dispose() the first time it works but then I just get errors:

ErrorObject reference not set to an instance of an object.

If I get a license for Crystal Reports 2016 do I need to recreate all my reports? I have never used the full Crystal Reports, so I don't know how to apply it. Basically I don't need to recreate any reports everything works fine until we hit the 75 limit and that is the only problem that I want to solve, so my question will be just buying a license for Crystal Reports 2016 and installing it on my web server will eliminate the 75 limit or I need to recreate reports and change the code of the application that creates the report?

Please let me know.

Thanks

Oswaldo

Share
10 |10000 characters needed characters left characters exceeded
Dell Stinnett-Christy Dec 23, 2016 at 04:51 PM
0

No, you will not need to recreate all of your reports. However, just getting a license for Crystal 2016 will NOT resolve your problem. You will need to purchase Crystal Reports Server 2016 (CRS), install it on a server, publish your reports to it, and use the BI Platform or OpenDocument SDK to view your reports from CRS, which means changing the application code.

-Dell

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Dec 27, 2016 at 02:20 PM
0

Hello,

Thank you for the clarification, I guess I will have to find how to publish reports from Visual Studio to the server and then how to change the code. I found some information about the close and dispose that may help, the problem is that the report is stored in session for paging and when removed from session it starts giving errors. I have to say that I am disappointed in Crystal Reports, at this point SSRS could be a better option.

Anyway thank you for your help.

Regards,

Oswaldo

Share
10 |10000 characters needed characters left characters exceeded
Don Williams
Jan 03, 2017 at 03:07 PM
0

Hi Oswaldo,

Odd, others do not have this issue so check your code, make sure you are closing the session after the report is done and not before.

Also use the Postback method so the WEB server is aware of the released report object.

Don

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Jan 04, 2017 at 05:44 PM
0

Hello Don,

I am new to Crystal Reports on a web application, I have been using Crystal Reports for years in Windows Applications and I have never had this problem. I am posting the code and hopefully I can get an advise on where to put the close and dispose methods. I tried putting at the end of the

btnPrev_Click

but then the report doesn't show on the screen. I tried on the Unload and removing session["LoadByZone"] but then it shows fine one time and when users selects a different parameter I get an error and nothing shows. Any help will be appreciated it.

Thanks, Oswaldo

public partial class LoadByZone1 : Page
    {
        ReportDocument crystalReport = new ReportDocument();

        private void InitializeComponent()
        {
            this.Unload += new System.EventHandler(this.Page_Unload);
        }

        private void Page_Unload(object sender, EventArgs e)
        {
            //crystalReport.Dispose();
            GC.Collect();
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                    if (clsGlobal.CurrentSessionUser != null)
                    {
                        if (
                            !clsGlobal.CheckPermission(clsGlobal.CurrentSessionUser.Type,
                                clsGlobal.GetEnumDescription(enumModule.REPORTS)))
                            Response.Redirect("~/Dashboard.aspx");
                        if (Session["LoadByZone"] != null)
                            CrystalReportViewer1.ReportSource = null;
                        
                    }

                //EnableDisable();
            }
            catch (ThreadAbortException)
            {
            }
            catch (Exception)
            {
            }
        }

        protected void Page_Init(object sender, EventArgs e)
        {
            if (Session["LoadByZone"] != null)
                CrystalReportViewer1.ReportSource = (ReportDocument) Session["LoadByZone"];
        }

        protected void btnPrev_Click(object sender, EventArgs e)
        {
            try
            {
                for (var i = 0; i < CrystalReportViewer1.LogOnInfo.Count; i++)
                    CrystalReportViewer1.LogOnInfo[i].ConnectionInfo = SiteMaster.GetCrystalConnection();
                var datesTo = txtDateTo.Text.Split('/');
                var datesFrom = txtDateFrom.Text.Split('/');

                hdnFromDate.Value = txtDateFrom.Text;
                hdnToDate.Value = txtDateTo.Text;

                var YearTo = datesTo[2];
                var MonthTo = datesTo[0];
                var DateTo = datesTo[1];

                var YearFrom = datesFrom[2];
                var MonthFrom = datesFrom[0];
                var DateFrom = datesFrom[1];

                var flag = true;
                crystalReport.Load(Server.MapPath("~/Reports/LoadsByZone.rpt"));
                var obj = new clsReport();
                CrystalReportViewer1.ReportSource = null;

                if ((rbHauler.Text == "Hauler") && (chkTolls.Checked == false))
                {
                    DataSet dsCount = obj.GetZone(YearFrom + "/" + MonthFrom + "/" + DateFrom,
                    YearTo + "/" + MonthTo + "/" + DateTo, ddlBillTo.SelectedValue, ddlHauler.SelectedValue, 2);
                    Session["Load"] = dsCount;
                    if ((dsCount != null) && (dsCount.Tables[0].Rows.Count > 0))
                    {
                        crystalReport.SetDataSource(obj.GetZone(YearFrom + "/" + MonthFrom + "/" + DateFrom,
                    YearTo + "/" + MonthTo + "/" + DateTo, ddlBillTo.SelectedValue, ddlHauler.SelectedValue, 2));
                        crystalReport.SetParameterValue("Title", ddlHauler.SelectedItem.Text);
                        flag = true;
                    }
                    else
                    {
                        ScriptManager.RegisterClientScriptBlock(this, GetType(), "Success",
                      "<script>ShowWarningPrompt('There is not information on this range of dates!');</script>",
                            false);
                        flag = false;
                        CrystalReportViewer1.ReportSource = null;
                    }
                }
                else if (rbHauler.Text == "BillTo")
                {
                    crystalReport.Load(Server.MapPath("~/Reports/ZonesBillTo.rpt"));
                    DataSet dsCount = obj.GetBillZone(YearFrom + "/" + MonthFrom + "/" + DateFrom,
                        YearTo + "/" + MonthTo + "/" + DateTo, ddlBillTo.SelectedValue);
                    Session["Load"] = dsCount;
                    if ((dsCount != null) && (dsCount.Tables[0].Rows.Count > 0))
                    {
                        crystalReport.SetDataSource(obj.GetBillZone(YearFrom + "/" + MonthFrom + "/" + DateFrom,
                            YearTo + "/" + MonthTo + "/" + DateTo, ddlBillTo.SelectedValue));
                        crystalReport.SetParameterValue("Title", ddlBillTo.SelectedItem.Text);
                        flag = true;
                    }
                    else
                    {
                        ScriptManager.RegisterClientScriptBlock(this, GetType(), "Success",
                       "<script>ShowWarningPrompt('There is not information on this range of dates!');</script>",
                            false);
                        flag = false;
                        CrystalReportViewer1.ReportSource = null;
                    }
                }
                if (flag == false)
                {
                    txtDateFrom.Attributes.Remove("readonly");
                    txtDateTo.Attributes.Remove("readonly");
                    rbHauler.Enabled = true;
                    chkTolls.Enabled = true;
                }
                else
                {
                    CrystalReportViewer1.ReportSource = crystalReport;
                    Session.Add("LoadByZone", crystalReport);
                    txtDateFrom.Attributes.Add("readonly", "readonly");
                    txtDateTo.Attributes.Add("readonly", "readonly");
                    rbHauler.Enabled = false;
                    chkTolls.Enabled = false;
                    flag = true;
                }

                //crystalReport.Close();
                //crystalReport.Dispose();
            }
            catch (ThreadAbortException)
            {
            }
        }

        protected void btnCancel_Click(object sender, EventArgs e)
        {
            txtDateFrom.Attributes.Remove("readonly");
            txtDateTo.Attributes.Remove("readonly");
            rbHauler.Enabled = true;
            chkTolls.Enabled = true;
            EnableDisable();
            CrystalReportViewer1.ReportSource = null;
            Session.Remove("Load");
        }
    }

Share
10 |10000 characters needed characters left characters exceeded