private void btnSearchDate_Click(object sender, EventArgs e) { CrystalReportIncomeReport cr = new CrystalReportIncomeReport(); SqlConnection conn = new SqlConnection(); conn = DbConnection.getConnection(); string appointmentdate = txtAppointmentDate.Value.ToString("dd MMM yyyy"); conn.Open(); string sql = "select * from IncomeReport2 where appointmentdate='" + appointmentdate + "'"; DataSet ds = new DataSet(); SqlDataAdapter adapter = new SqlDataAdapter(sql, conn); adapter.Fill(ds, "IncomeReport2"); DataTable dt = ds.Tables["IncomeReport2"]; cr.SetDataSource(ds.Tables["IncomeReport2"]); crystalReportViewer6.ReportSource = cr; crystalReportViewer6.Refresh(); conn.Close(); }
public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { CrystalReportIncomeReport rpt = new CrystalReportIncomeReport(); rpt.Site = this.Site; return(rpt); }
private void frmIncomeReport_Load(object sender, EventArgs e) { this.btnSearchDate.Image = WindowsFormsApplication1.Properties.Resources.search_icon_16; CrystalReportIncomeReport cr = new CrystalReportIncomeReport(); SqlConnection conn = new SqlConnection(); conn = DbConnection.getConnection(); conn.Open(); string sql = "select * from IncomeReport2"; DataSet ds = new DataSet(); SqlDataAdapter adapter = new SqlDataAdapter(sql, conn); adapter.Fill(ds, "IncomeReport2"); DataTable dt = ds.Tables["IncomeReport2"]; cr.SetDataSource(ds.Tables["IncomeReport2"]); crystalReportViewer6.ReportSource = cr; crystalReportViewer6.Refresh(); conn.Close(); }