private void textShow_TextChanged(object sender, EventArgs e) { CrystalReport1 cr = new CrystalReport1(); // con = connection.Activecon(); con.Open(); String sql = "Select * from SupplyMaterialView where Supply_Id = '" + textShow.Text + "'"; DataSet ds = new DataSet(); SqlDataAdapter adapter = new SqlDataAdapter(sql, con); adapter.Fill(ds, "SupplyMaterialView"); DataTable dt = ds.Tables["SupplyMaterialView"]; cr.SetDataSource(ds.Tables["SupplyMaterialView"]); crystalReportViewer1.ReportSource = cr; crystalReportViewer1.Refresh(); con.Close(); // bs.Filter = "Supply_Id like '%" + text_Supply_Search.Text + "%' OR ProjectId like '" + text_Supply_Search.Text + "'"; // SupplyView.DataSource = bs; }
// SqlCommand command = new SqlCommand(); private void btnReport_Click(object sender, EventArgs e) { CrystalReport1 cr = new CrystalReport1(); con.Open(); // con = connection.Activecon(); //SqlConnection con = new SqlConnection(); //con.ConnectionString = ConfigurationManager.ConnectionStrings["Stock.Properties.Settings.KSLConnectionString"].ToString(); String sql = "Select * from SupplyMaterialView"; DataSet ds = new DataSet(); SqlDataAdapter adapter = new SqlDataAdapter(sql, con); adapter.Fill(ds, "SupplyMaterialView"); DataTable dt = ds.Tables["SupplyMaterialView"]; cr.SetDataSource(ds.Tables["SupplyMaterialView"]); crystalReportViewer1.ReportSource = cr; crystalReportViewer1.Refresh(); con.Close(); }