0
Answer

crystal report

anil john

anil john

11y
1.1k
1
Getting a message while debugging as "Load report failed "
plz help me to rectify this

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MagnaBL;
//using CrystalDecisions.CrystalReports.Engine;
//using CrystalDecisions.Shared;
namespace MAGNA
{
    public partial class frmCommissionReport : Form
    {
        #region Declaration

        string vExecutive = "";
        GeneralMasterBL objGeneralMasterBL = new GeneralMasterBL();
        #endregion

        #region Propwerties

        public string Executive
        {
            get
            {
                return vExecutive;
            }
            set
            {
                vExecutive = value;
            }
        }

        #endregion
        public frmCommissionReport()
        {
            InitializeComponent();
        }

        private void frmCommissionReport_Load(object sender, EventArgs e)
        {
            CrystalDecisions.CrystalReports.Engine.ReportDocument rpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
            DataTable ds = new DataTable();
            ds = objGeneralMasterBL.fnGetCommission(vExecutive);
            string strReportPath = Application.StartupPath + "\\Reports\\rptCommission.rpt";
            rpt.Load(strReportPath);
            rpt.SetDataSource(ds);//.tables[0]
            rpt.Refresh();
            crystalReportViewer1.ReportSource = rpt;
            crystalReportViewer1.RefreshReport();

            crystalReportViewer1.ShowCloseButton = true;

            crystalReportViewer1.DisplayGroupTree = false;
            crystalReportViewer1.ShowRefreshButton = true;
            crystalReportViewer1.ShowGroupTreeButton = true;
            crystalReportViewer1.ShowPrintButton = true;
        }
    }
}