예제 #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            Rptsales rpt = new Rptsales();

            rpt.Site = this.Site;
            return(rpt);
        }
예제 #2
0
 public void R2()
 {
     try
     {
         Cursor         = Cursors.WaitCursor;
         timer1.Enabled = true;
         Rptsales rpt = new Rptsales();
         //The report you created.
         SqlConnection  myConnection = default(SqlConnection);
         SqlCommand     MyCommand    = new SqlCommand();
         SqlDataAdapter myDA         = new SqlDataAdapter();
         DataSet        myDS         = new DataSet();
         //The DataSet you created.
         myConnection          = new SqlConnection(cs.DBcon);
         MyCommand.Connection  = myConnection;
         MyCommand.CommandText = "select * from investment,client,sales where client.id=investment.clientid and investment.inv_ID=sales.investmentid and sales.Date between @date1 and @date2 order by sales.Date";
         MyCommand.Parameters.Add("@date1", SqlDbType.DateTime, 30, "Date").Value = Date_from.Value.Date;
         MyCommand.Parameters.Add("@date2", SqlDbType.DateTime, 30, "Date").Value = Date_to.Value.Date;
         MyCommand.CommandType = CommandType.Text;
         myDA.SelectCommand    = MyCommand;
         myDA.Fill(myDS, "investment");
         myDA.Fill(myDS, "client");
         myDA.Fill(myDS, "sales");
         rpt.SetDataSource(myDS);
         crystalReportViewer2.ReportSource = rpt;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }