private void frmReportRawMaterial_Load(object sender, EventArgs e) { SqlConnection con; SqlCommand cmd; try { CrystalReportRawMaterial rpt = new CrystalReportRawMaterial(); //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 tblTmpStock"; cmd.CommandType = CommandType.Text; myDA.SelectCommand = cmd; myDA.Fill(myDS, "tblTmpStock"); rpt.SetDataSource(myDS); this.crystalReportViewer1.ReportSource = rpt; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { CrystalReportRawMaterial rpt = new CrystalReportRawMaterial(); rpt.Site = this.Site; return(rpt); }