代码新建二维表

#region "建立Judgement結構"
                string[,] Colstr ={ {"JudgementID","System.String"},
                                                    {"JudgementName","System.String"}};
                DataTable dtl = Function.CreatDataTable(Colstr, "Judgement");
                #endregion

                #region "填入Judgement內容"
                string[,] strContent ={{"1","Acceptable"},
                                                            {"2","Conditional (重工後允收)"},
                                                            {"3","Waive (特裁)"},
                                                            {"4","Reject"}};
                for (int j = 0; j < strContent.Length / 2; j++)
                {
                    DataRow dr = dtl.NewRow();
                    for (int i = 0; i < 2; i++)
                    {
                        dr[i] = strContent[j, i];
                    }
                    dtl.Rows.Add(dr);
                    dr = null;
                }
                #endregion

                return dtl;

 

posted @ 2014-01-22 11:36  雨后出太阳  阅读(238)  评论(0编辑  收藏  举报