コード例 #1
0
ファイル: Crystal.cs プロジェクト: Abishu14/ITP-Project
        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;
        }
コード例 #2
0
ファイル: Crystal.cs プロジェクト: Abishu14/ITP-Project
        // 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();
        }