Exemplo n.º 1
0
        private void btnSearchPatient_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txtInvoiceNo.Text))
            {
                MessageBox.Show("The invoice number should be entered.", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                CrystalReportGenerateInvoice cr = new CrystalReportGenerateInvoice();
                SqlConnection conn = new SqlConnection();
                conn = DbConnection.getConnection();

                string pino = txtInvoiceNo.Text;

                conn.Open();
                string sql = "select * from generateinvoice where invoiceno='" + pino + "'";

                DataSet        ds      = new DataSet();
                SqlDataAdapter adapter = new SqlDataAdapter(sql, conn);

                adapter.Fill(ds, "generateinvoice");
                DataTable dt = ds.Tables["generateinvoice"];

                cr.SetDataSource(ds.Tables["generateinvoice"]);
                crystalReportViewer4.ReportSource = cr;
                crystalReportViewer4.Refresh();
                conn.Close();
            }
        }
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            CrystalReportGenerateInvoice rpt = new CrystalReportGenerateInvoice();

            rpt.Site = this.Site;
            return(rpt);
        }