文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>C#动态创建DataTable

C#动态创建DataTable

时间:2010-11-23  来源:aisoon99

   public DataTable Gettmp_CallByArea(System.Collections.ArrayList provinceName)
        {
            DataTable dt = new DataTable();//手动创建的新数据表
            //define the table’s schema
            dt.Columns.Add(new DataColumn("proname", typeof(string)));
            try
            {
                DataTable dt1 = null;//返回的DataTable
                if (provinceName.Count > 0)
                {
                    for (int i = 0; i < provinceName.Count;i++)
                    {
                        if (provinceName[i].ToString() != null)
                        {
                            dt1=GetData(provinceName[i].ToString(), dt);
                        }
                        else
                        {
                            dt1 = null;
                        }
                    }
                }
            }
            catch
            {
                return null;
            }
            return dt1;
        }
        public DataTable GetData(string proname, DataTable dt)
        {
          
            DataRow dr = dt.NewRow();
            dr["proname"] = proname;
            dt.Rows.Add(dr);
            return dt;
        }

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载