locked
Crystal report error RRS feed

  • Question

  • User639567535 posted

    i try to create a crystal report when i build it shows this

    where as i write code on page load

    code

     protected void Page_Load(object sender, EventArgs e)
            {
                
                //report code
                DataSet ds = new DataSet();
                Class1 myclass = new Class1();
                ds.Tables.Add(myclass.report1().Copy());
                ds.Tables[0].TableName = "spcustomers";
    
                CrystalReport1 report = new CrystalReport1();
                report.SetDataSource(ds);
                CrystalReportViewer1.ReportSource = report;
                CrystalReportViewer1.DataBind();
    
            }

    any help

    Thursday, January 21, 2016 4:06 AM

Answers

  • User2020942139 posted

    I cannot see your screenshot, however, this is my controller code when doing crystal reports with mvc:

        [HttpPost]
            public ActionResult DetAttReport(DateTime StartDate,DateTime EndDate,String Department)
            {
                if (Department == "")
                { Department ="0"; }
    
                ReportClass rptH = new ReportClass();
                rptH.FileName = Server.MapPath("~/ReportDocs/DetAtt.rpt");
                rptH.Load();
    
                 crConnectionInfo.ServerName = instanceName;
                crConnectionInfo.DatabaseName = "TimeAttendance";
                crConnectionInfo.IntegratedSecurity = true;
                //crConnectionInfo.UserID = "YOUR DATABASE USERNAME";
                //crConnectionInfo.Password = "YOUR DATABASE PASSWORD";
                CrTables = rptH.Database.Tables;
    
                foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
                {
                    crtableLogoninfo = CrTable.LogOnInfo;
                    crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                    CrTable.ApplyLogOnInfo(crtableLogoninfo);
                }
                rptH.SetParameterValue(0, Convert.ToInt32(Department));
                rptH.SetParameterValue(1, StartDate);
                rptH.SetParameterValue(2, EndDate);
      
                Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                return File(stream, "application/pdf");
            }
    

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, January 25, 2016 7:02 AM

All replies

  • User1724605321 posted

    Hi Scropio,

    Please refer to below links for discussions about same topic as yours:

    http://stackoverflow.com/questions/1186048/crystal-reports-the-report-you-requested-requires-further-information

    http://forums.asp.net/t/1026635.aspx?The+report+you+requested+requires+further+information

    And try to use datatable as datasource instead of dataset .

    Hope it helps.

    Best Regards,

    Nan Yu

    Thursday, January 21, 2016 7:02 AM
  • User-166373564 posted

    Hi Bakhtawar,

    For questions and discussions about Crystal Reports, you could get help from Crystal Reports forum.

    Regards,

    Angie

    Monday, January 25, 2016 6:34 AM
  • User2020942139 posted

    I cannot see your screenshot, however, this is my controller code when doing crystal reports with mvc:

        [HttpPost]
            public ActionResult DetAttReport(DateTime StartDate,DateTime EndDate,String Department)
            {
                if (Department == "")
                { Department ="0"; }
    
                ReportClass rptH = new ReportClass();
                rptH.FileName = Server.MapPath("~/ReportDocs/DetAtt.rpt");
                rptH.Load();
    
                 crConnectionInfo.ServerName = instanceName;
                crConnectionInfo.DatabaseName = "TimeAttendance";
                crConnectionInfo.IntegratedSecurity = true;
                //crConnectionInfo.UserID = "YOUR DATABASE USERNAME";
                //crConnectionInfo.Password = "YOUR DATABASE PASSWORD";
                CrTables = rptH.Database.Tables;
    
                foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
                {
                    crtableLogoninfo = CrTable.LogOnInfo;
                    crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                    CrTable.ApplyLogOnInfo(crtableLogoninfo);
                }
                rptH.SetParameterValue(0, Convert.ToInt32(Department));
                rptH.SetParameterValue(1, StartDate);
                rptH.SetParameterValue(2, EndDate);
      
                Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                return File(stream, "application/pdf");
            }
    

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, January 25, 2016 7:02 AM