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; var rpt = new rptCustomers(); cmd = new OleDbCommand(); var myDA = new OleDbDataAdapter(); var myDS = new SIS_DBDataSet(); con = new OleDbConnection(cs); cmd.Connection = con; cmd.CommandText = "SELECT * from Customer order by CustomerName"; cmd.CommandType = CommandType.Text; myDA.SelectCommand = cmd; myDA.Fill(myDS, "Customer"); rpt.SetDataSource(myDS); var frm = new frmCustomersReport(); frm.crystalReportViewer1.ReportSource = rpt; frm.Visible = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "ล้มเหลว", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { var rpt = new rptCustomers(); rpt.Site = Site; return rpt; }
private void button1_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; timer1.Enabled = true; var rpt = new rptCustomers(); cmd = new SqlCommand(); var myDA = new SqlDataAdapter(); var myDS = new SIS_DBDataSet(); con = new SqlConnection(cs); cmd.Connection = con; cmd.CommandText = "SELECT * from Customer order by CustomerName"; cmd.CommandType = CommandType.Text; myDA.SelectCommand = cmd; myDA.Fill(myDS, "Customer"); rpt.SetDataSource(myDS); var frm = new frmCustomersReport(); frm.crystalReportViewer1.ReportSource = rpt; frm.Visible = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "ล้มเหลว", MessageBoxButtons.OK, MessageBoxIcon.Error); } }