using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Microsoft.VisualBasic; using System.Collections; using System.Data; using System.Diagnostics; using CrystalDecisions.CrystalReports.Engine; using System.Data.SqlClient; using System.Text; using CrystalDecisions.Shared; namespace Helpdesk { public partial class report_jobm : System.Web.UI.Page { oCenter oC = new oCenter(); protected void Page_Load(object sender, EventArgs e) { ConfigureCrystalReports(); } private ReportDocument rpt; void ConfigureCrystalReports() { rpt = new ReportDocument(); rpt.Load(Server.MapPath("report4.rpt")); TableLogOnInfo crtableLogoninfo = new TableLogOnInfo(); ConnectionInfo crConnectionInfo = new ConnectionInfo(); Tables CrTables; crConnectionInfo.ServerName = "TOEY-PC"; crConnectionInfo.DatabaseName = "Helpdesk"; crConnectionInfo.UserID = "sa"; crConnectionInfo.Password = "password"; CrTables = rpt.Database.Tables; foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables) { crtableLogoninfo = CrTable.LogOnInfo; crtableLogoninfo.ConnectionInfo = crConnectionInfo; CrTable.ApplyLogOnInfo(crtableLogoninfo); } rpt.SetParameterValue("startdate", Session["startdate"].ToString()); rpt.SetParameterValue("enddate", Session["enddate"].ToString()); this.CrystalReportViewer1.ReportSource = rpt; CrystalReportViewer1.PrintMode = CrystalDecisions.Web.PrintMode.ActiveX; Session["ReportSource1"] = rpt; } protected override void OnUnload(EventArgs e) { base.OnUnload(e); try { if (rpt != null) { rpt.Close(); rpt.Dispose(); GC.Collect(); } } catch (Exception ex) { // Exception } } protected void rptCrystal_Unload(object sender, EventArgs e) { try { if (rpt != null) { rpt.Close(); rpt.Dispose(); GC.Collect(); } } catch (Exception ex) { // Exception } } } }
if(!Page.IsPostBack()) { ConfigureCrystalReports(); }
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง