private void bt_Request_Click(object sender, EventArgs e) { // Local Variables String mySql; String AsAtDate = dtp_AsAtDate.Value.ToString("dd-MMM-yyyy"); String FundID = ((DataRowView)(cb_Fund.SelectedItem)).Row.ItemArray[0].ToString();; String FundName = ((DataRowView)(cb_Fund.SelectedItem)).Row.ItemArray[1].ToString(); // hourglass cursor Cursor.Current = Cursors.WaitCursor; mySql = "Exec sp_NAV_Rec @FundId = " + FundID + ", @ActionsNeeded = null, @DisplayOrder = null, @AsAtDate = '" + AsAtDate + "' "; dt_NAV_Rec = SystemLibrary.SQLSelectToDataTable(mySql); // Crystal Report cr_NAV_Rec objRpt = new cr_NAV_Rec(); objRpt.SetDataSource(dt_NAV_Rec); CrystalDecisions.CrystalReports.Engine.TextObject root; root = (CrystalDecisions.CrystalReports.Engine.TextObject)objRpt.ReportDefinition.ReportObjects["TextTitle_FundName"]; root.Text = FundName; root = (CrystalDecisions.CrystalReports.Engine.TextObject)objRpt.ReportDefinition.ReportObjects["TextTitle_AsAtDate"]; root.Text = AsAtDate; // Binding the crystalReportViewer with our report object. objRpt.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape; crv_NAV_Rec.ReportSource = objRpt; HideTheTabControl(crv_NAV_Rec); Cursor.Current = Cursors.Default; } //bt_Request_Click()
public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { cr_NAV_Rec rpt = new cr_NAV_Rec(); rpt.Site = this.Site; return(rpt); }