private void frmReportLabor_Load(object sender, EventArgs e) { SqlConnection con; SqlCommand cmd; try { CrystalReportLabor rpt = new CrystalReportLabor(); //The report you created. cmd = new SqlCommand(); SqlDataAdapter myDA = new SqlDataAdapter(); DataSet1 myDS = new DataSet1(); //The DataSet you created. con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename='D:\MCS\SEM - II\CS - 204 Project\MD Bricks Supplier\MD Brief Supplier\dBMaheshBricksSupplier.mdf';Integrated Security=True;Connect Timeout=30"); cmd.Connection = con; cmd.CommandText = "select * from tblLaborWork"; cmd.CommandType = CommandType.Text; myDA.SelectCommand = cmd; // myDA.Fill(myDS, "tblLabor"); myDA.Fill(myDS, "tblLaborWork"); rpt.SetDataSource(myDS); this.crystalReportViewer1.ReportSource = rpt; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { CrystalReportLabor rpt = new CrystalReportLabor(); rpt.Site = this.Site; return(rpt); }