Example #1
0
        private void 查询_试验组数据()
        {
            DataTable dt = _form.SelectTabs("dbo.生成试验组");

            // object value = null;
            if (GridDataTabel == null)
            {
                GridDataTabel = new DataTable();
                GridDataTabel.Columns.Add("ID");
                GridDataTabel.Columns.Add("试验日期");
                GridDataTabel.Columns.Add("试验组名");
                GridDataTabel.Columns.Add("试验编号");
            }
            GridDataTabel.Clear();

            foreach (DataRow dr in dt.Rows)
            {
                DataRow  GridDataRow = GridDataTabel.NewRow();                           //声明行
                object[] objs        = { dr["ID"], dr["试验日期"], dr["试验组名"], dr["试验编号"] }; //赋值
                GridDataRow.ItemArray = objs;
                GridDataTabel.Rows.Add(GridDataRow);                                     //添加行
            }

            this.grid1.SetDataSource(GridDataTabel);
        }