private void RaportClienti_Load(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; timer1.Enabled = true; rptClienti rpt = new rptClienti(); //The report you created. cmd = new SqlCommand(); SqlDataAdapter myDA = new SqlDataAdapter(); Restaurant myDS = new Restaurant(); //The DataSet you created. con = new SqlConnection(cs.DBConn); cmd.Connection = con; cmd.CommandText = "SELECT * from Clienti order by Nume_client"; cmd.CommandType = CommandType.Text; myDA.SelectCommand = cmd; myDA.Fill(myDS, "Clienti"); rpt.SetDataSource(myDS); crystalReportViewer1.ReportSource = rpt; } catch (Exception ex) { MessageBox.Show(ex.Message, "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { rptClienti rpt = new rptClienti(); rpt.Site = this.Site; return(rpt); }