Exemplo n.º 1
0
        private void tsbSeach_Click(object sender, EventArgs e)
        {
            DataSet              ds   = new DataSet();
            DataTable            dt   = new DataTable("ByProduct");
            ByPortductSelectForm bpsf = new ByPortductSelectForm();
            ByProductEntity      boe  = new ByProductEntity();

            if (DialogResult.OK == bpsf.ShowDialog())
            {
                DataColumn dc = null;
                dc = dt.Columns.Add("PARTM", Type.GetType("System.String"));
                dc = dt.Columns.Add("PARTB2", Type.GetType("System.String"));
                dc = dt.Columns.Add("PARTB3", Type.GetType("System.String"));
                dc = dt.Columns.Add("PARTTYPE", Type.GetType("System.String"));
                dc = dt.Columns.Add("PARTCREATER", Type.GetType("System.String"));
                dc = dt.Columns.Add("PARTCS", Type.GetType("System.DateTime"));
                dc = dt.Columns.Add("PARTCE", Type.GetType("System.DateTime"));
                dc = dt.Columns.Add("PARTEDITER", Type.GetType("System.String"));
                //dc = dt.Columns.Add("PARTES", Type.GetType("System.DateTime"));
                //dc = dt.Columns.Add("PARTEE", Type.GetType("System.DateTime"));

                DataRow newRow = dt.NewRow();
                newRow["PARTM"]       = bpsf.strM;
                newRow["PARTB2"]      = bpsf.strB2;
                newRow["PARTB3"]      = bpsf.strB3;
                newRow["PARTTYPE"]    = bpsf.strType;
                newRow["PARTCREATER"] = bpsf.strCreater;
                newRow["PARTCS"]      = bpsf.strCtstart;
                newRow["PARTCE"]      = bpsf.strCtsend;
                newRow["PARTEDITER"]  = bpsf.strEditer;
                //newRow["PARTES"] = bpsf.strEtstart;
                //newRow["PARTEE"] = bpsf.strEtsend;
                dt.Rows.Add(newRow);

                ds.Tables.Add(dt);
                DataSet   dsreturn    = boe.GetByProductInf(ds);
                DataTable dtByProduct = dsreturn.Tables[0];
                gcList.DataSource = dtByProduct;
            }
        }
Exemplo n.º 2
0
        //数据表绑定数据
        public void BindDataGridSource()
        {
            DataSet         ds  = new DataSet();
            DataTable       dt  = new DataTable("ByProduct");
            ByProductEntity boe = new ByProductEntity();
            DataColumn      dc  = null;

            dc = dt.Columns.Add("PARTM", Type.GetType("System.String"));
            dc = dt.Columns.Add("PARTB2", Type.GetType("System.String"));
            dc = dt.Columns.Add("PARTB3", Type.GetType("System.String"));
            dc = dt.Columns.Add("PARTTYPE", Type.GetType("System.String"));
            dc = dt.Columns.Add("PARTCREATER", Type.GetType("System.String"));
            dc = dt.Columns.Add("PARTCS", Type.GetType("System.String"));
            dc = dt.Columns.Add("PARTCE", Type.GetType("System.String"));
            dc = dt.Columns.Add("PARTEDITER", Type.GetType("System.String"));
            //dc = dt.Columns.Add("PARTES", Type.GetType("System.String"));
            //dc = dt.Columns.Add("PARTEE", Type.GetType("System.String"));

            DataRow newRow = dt.NewRow();

            newRow["PARTM"]       = string.Empty;
            newRow["PARTB2"]      = string.Empty;
            newRow["PARTB3"]      = string.Empty;
            newRow["PARTTYPE"]    = string.Empty;
            newRow["PARTCREATER"] = string.Empty;
            newRow["PARTCS"]      = string.Empty;
            newRow["PARTCE"]      = string.Empty;
            newRow["PARTEDITER"]  = string.Empty;
            //newRow["PARTES"] =string.Empty;
            //newRow["PARTEE"] = string.Empty;
            dt.Rows.Add(newRow);

            ds.Tables.Add(dt);
            DataSet   dsreturn    = boe.GetByProductInf(ds);
            DataTable dtByProduct = dsreturn.Tables[0];

            gcList.DataSource = dtByProduct;
        }