mohaammed talha

mohaammed talha

  • 1.6k
  • 341
  • 8.2k

Failed to load database information in crystal reprot asp.net c#

Jul 30 2021 6:15 AM

Error in File CrystalReport1 19460_12996_{1FAC5040-8D16-4E07-90ED-903C4DB8EA5D}.rpt:
Failed to load database information.

protected void Report()
{
    DataTable dt = new DataTable();
    string query = @"select a.CompanyCode,c.CompanyName,a.EmployeeCode,b.EmployeeName,a.ProcessDate,a.Shift,a.CheckIn,a.CheckOut,a.HoursWorked,a.ExtraHours from paySwipeLOG a left join payEmployeeMaster b on a.EmployeeCode=b.EmployeeCode left join admCompanyNew c on a.CompanyCode=c.CompanyCode left join payAttribute d on b.DepartmentCode=d.AttributeCode and d.AttributeID='2' where a.EmployeeCode='bs866'";
    SqlDataAdapter objAdapter = new SqlDataAdapter(query, strConn);
    objAdapter.Fill(dt);
    objAdapter.Dispose();

    if (dt.Rows.Count > 0)
    {
        string reportPath = "~/CrystalReport1.rpt";
        ReportDocument rd = new ReportDocument();
        //rd.Load(reportPath);
        rd.Load(Server.MapPath("~/CrystalReport1.rpt"));
        rd.SetDatabaseLogon("Eureka", "Eureka.net", "192.168.1.6",
                                      "FaridaHRM2122");
        rd.SetDataSource(dt);
        CrystalReportViewer1.ReportSource = rd;
        //CrystalReportViewer1.Refresh();
    }
}

 


Answers (1)