Ejemplo n.º 1
0
        private void rptDeath()
        {
            try
            {
                SqlConnection conn = new SqlConnection(DBLayer.CON_string);
                SqlCommand    cmd  = new SqlCommand(richTextBox2.Text);

                cmd.Connection = conn;

                cmd.CommandType = CommandType.Text;

                SqlParameter paraStartDate = cmd.Parameters.Add("@FromDate", SqlDbType.DateTime);
                paraStartDate.Value = Convert.ToDateTime(dateTimePicker1.Text);

                SqlParameter paraEndDate = cmd.Parameters.Add("@ToDate", SqlDbType.DateTime);
                paraEndDate.Value = Convert.ToDateTime(dateTimePicker2.Text);

                SqlDataAdapter sda = new SqlDataAdapter(cmd);

                DataTable aaa = new DataTable();

                sda.Fill(aaa);

                MCKJ.Reports.Donation.frmViewer frm = new MCKJ.Reports.Donation.frmViewer();
                Reports.BirthDeath.rptDeath     rpt = new rptDeath();

                rpt.SetDataSource(aaa);

                rpt.SetParameterValue("fromDate", Convert.ToDateTime(dateTimePicker1.Text));
                rpt.SetParameterValue("toDate", Convert.ToDateTime(dateTimePicker2.Text));


                frm.crystalReportViewer1.ReportSource = rpt;

                //frm.Text = "Purchase Bill";

                frm.Show();

                conn.Close();
            }
            catch (Exception exceptionparamter)
            {
                MessageBox.Show("Unable to view report!\n\n" + exceptionparamter.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Ejemplo n.º 2
0
 public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() {
     rptDeath rpt = new rptDeath();
     rpt.Site = this.Site;
     return rpt;
 }