public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            rptEvents rpt = new rptEvents();

            rpt.Site = this.Site;
            return(rpt);
        }
예제 #2
0
        private void frmEventsReport_Load(object sender, EventArgs e)
        {
            try
            {
                Cursor         = Cursors.WaitCursor;
                timer1.Enabled = true;
                rptEvents rpt = new rptEvents();
                //The report you created.
                SqlConnection  myConnection = default(SqlConnection);
                SqlCommand     MyCommand    = new SqlCommand();
                SqlDataAdapter myDA         = new SqlDataAdapter();
                CMS_DBDataSet1 myDS         = new CMS_DBDataSet1();
                //The DataSet you created.


                myConnection          = new SqlConnection(cs.DBConn);
                MyCommand.Connection  = myConnection;
                MyCommand.CommandText = "select * from Event";

                MyCommand.CommandType = CommandType.Text;
                myDA.SelectCommand    = MyCommand;
                myDA.Fill(myDS, "Event");
                rpt.SetDataSource(myDS);
                crystalReportViewer1.ReportSource = rpt;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }