public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { rptCustomers rpt = new rptCustomers(); rpt.Site = this.Site; return(rpt); }
private void button1_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; timer1.Enabled = true; rptCustomers rpt = new rptCustomers(); //The report you created. cmd = new MySqlCommand(); MySqlDataAdapter myDA = new MySqlDataAdapter(); //SIS_DBDataSet myDS = new SIS_DBDataSet(); DataSet myDS = new DataSet(); //The DataSet you created. con = new MySqlConnection(connString()); cmd.Connection = con; cmd.CommandText = "SELECT * from customer order by CusName"; //dt = Select("SELECT * from customer"); //cmd.CommandType = CommandType.Text; myDA.SelectCommand = cmd; myDA.Fill(myDS); rpt.SetDataSource(myDS); frmCustomersReport frm = new frmCustomersReport(); frm.crystalReportViewer1.ReportSource = rpt; frm.Visible = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }