public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { CrystalReport2 rpt = new CrystalReport2(); rpt.Site = this.Site; return(rpt); }
private void textReceivedShow_TextChanged(object sender, EventArgs e) { CrystalReport2 cr = new CrystalReport2(); // con = connection.Activecon(); con.Open(); String sql = "Select * from ReceivedView where Received_Id = '" + textReceivedShow.Text + "'"; DataSet ds = new DataSet(); SqlDataAdapter adapter = new SqlDataAdapter(sql, con); adapter.Fill(ds, "ReceivedView"); DataTable dt = ds.Tables["ReceivedView"]; cr.SetDataSource(ds.Tables["ReceivedView"]); crystalReportViewer2.ReportSource = cr; crystalReportViewer2.Refresh(); con.Close(); }
// SqlCommand command = new SqlCommand(); private void btnReceivedReport_Click(object sender, EventArgs e) { CrystalReport2 cr = new CrystalReport2(); con.Open(); //con = connection.Activecon(); //SqlConnection con = new SqlConnection(); //con.ConnectionString = ConfigurationManager.ConnectionStrings["Stock.Properties.Settings.KSLConnectionString"].ToString(); String sql = "Select * from ReceivedView"; DataSet ds = new DataSet(); SqlDataAdapter adapter = new SqlDataAdapter(sql, con); adapter.Fill(ds, "ReceivedView"); DataTable dt = ds.Tables["ReceivedView"]; cr.SetDataSource(ds.Tables["ReceivedView"]); crystalReportViewer2.ReportSource = cr; crystalReportViewer2.Refresh(); con.Close(); }