private void Rapor4_Load(object sender, EventArgs e) { SqlDataAdapter adtr = new SqlDataAdapter("select * from yapi", con); adtr.Fill(tablo); CrystalReport4 rapor4 = new CrystalReport4(); rapor4.SetDataSource(tablo); crystalReportViewer1.ReportSource = rapor4; }
private void CreateReport() { Data data = new Data(); var result = (from supp in data.Inf_Staff where supp.Staff_TimeAdd >= dt1.Value && supp.Staff_TimeAdd <= dt2.Value select new { supp.Staff_Id, supp.Staff_Name, supp.Staff_Phone, supp.Staff_Address }); CrystalReport4 rp = new CrystalReport4(); rp.SetDataSource(result); crystalReportViewer1.ReportSource = rp; }
/// <summary> /// Download PDF of Policy and rules /// </summary> /// <returns></returns> public ActionResult ExportPolicyAndRules() { List <PolicyAndRule> allCustomer = new List <PolicyAndRule>(); allCustomer = db.PolicyAndRules.ToList(); CrystalReport4 rd = new CrystalReport4(); rd.Load(Path.Combine(Server.MapPath("~/CrystalReports"), "ReportCustomer.rpt")); rd.SetDataSource(allCustomer); Response.Buffer = false; Response.ClearContent(); Response.ClearHeaders(); Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); stream.Seek(0, SeekOrigin.Begin); return(File(stream, "application/pdf", "PolicyAndRulelist.pdf")); }