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

            rpt.Site = this.Site;
            return(rpt);
        }
コード例 #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                con.Open();


                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = new SqlCommand("execute allProfitDate @date", con);
                da.SelectCommand.Parameters.AddWithValue("@date", textBox1.Text);

                DataTable dt = new DataTable();
                da.Fill(dt);

                profitReportDate myreport = new profitReportDate();
                myreport.SetDataSource(dt);
                profitView pv = new profitView();
                pv.crystalReportViewer1.ReportSource = myreport;
                pv.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "errorr!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                con.Close();
            }
        }