Ejemplo n.º 1
0
        private void button5_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor         = Cursors.WaitCursor;
                timer1.Enabled = true;
                Rptsales1 rpt = new Rptsales1();
                //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 client.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);
            }
        }
Ejemplo n.º 2
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            Rptsales1 rpt = new Rptsales1();

            rpt.Site = this.Site;
            return(rpt);
        }