コード例 #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            rptFatura rpt = new rptFatura();

            rpt.Site = this.Site;
            return(rpt);
        }
コード例 #2
0
 private void btnPrint_Click(object sender, EventArgs e)
 {
     try
     {
         Cursor         = Cursors.WaitCursor;
         timer1.Enabled = true;
         rptFatura rpt = new rptFatura();
         //The report you created.
         cmd = new SqlCommand();
         SqlDataAdapter myDA = new SqlDataAdapter();
         RMS_DBDataSet  myDS = new RMS_DBDataSet();
         //The DataSet you created.
         con                = new SqlConnection(cs.DBConn);
         cmd.Connection     = con;
         cmd.CommandText    = "SELECT * from invoice_info,productsold where invoice_info.invoiceno=productsold.invoiceno and Invoice_info.invoiceNo='" + txtNumPedido.Text + "'";
         cmd.CommandType    = CommandType.Text;
         myDA.SelectCommand = cmd;
         myDA.Fill(myDS, "Invoice_Info");
         myDA.Fill(myDS, "ProductSold");
         rpt.SetDataSource(myDS);
         frmFaturaReport frm = new frmFaturaReport();
         //frm.crystalReportViewer1.ReportSource = rpt;
         frm.Visible = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }