Exemplo n.º 1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            Rptsales2 rpt = new Rptsales2();

            rpt.Site = this.Site;
            return(rpt);
        }
Exemplo n.º 2
0
        private void button5_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor         = Cursors.WaitCursor;
                timer1.Enabled = true;
                Rptsales2 rpt = new Rptsales2();
                //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 FirstName = '" + cmbclientname.Text + "'";

                MyCommand.CommandType = CommandType.Text;
                myDA.SelectCommand    = MyCommand;
                myDA.Fill(myDS, "investment");
                myDA.Fill(myDS, "client");
                myDA.Fill(myDS, "sales");
                rpt.SetDataSource(myDS);

                crystalReportViewer1.ReportSource = rpt;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }