protected void loadReport(string cachedReports) { //int rptCacheTimeout = Convert.ToInt32(ConfigurationManager.AppSettings.Get("rptCacheTimeout").ToString()); DailyCostSheet rpt = new DailyCostSheet(); string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; SqlConnection connection = new SqlConnection(connectionString); SqlDataAdapter adapter = new SqlDataAdapter(); DataSet ds = new DataSet(); string startdate = Request.QueryString["st"].ToString(); string enddate = Request.QueryString["ed"].ToString(); adapter = new SqlDataAdapter("select * from vwDailyCostSheet where (date_ between @startdate and @enddate)", connection); adapter.SelectCommand.Parameters.Add("@startdate", SqlDbType.DateTime).Value = startdate; adapter.SelectCommand.Parameters.Add("@enddate", SqlDbType.DateTime).Value = enddate; if (connection.State == ConnectionState.Closed) { connection.Open(); } adapter.Fill(ds, "vwDailyCostSheet"); rpt.SetDataSource(ds); adapter.Dispose(); connection.Dispose(); //Cache.Insert(cachedReports, rpt, null, DateTime.MaxValue, TimeSpan.FromMinutes(rptCacheTimeout)); Session[cachedReports] = rpt; DailyCostSheetReport_All.ReportSource = rpt; }
public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { DailyCostSheet rpt = new DailyCostSheet(); rpt.Site = this.Site; return(rpt); }