请问怎么把dataset的列名取出来,放在一个数组A里,然后在自定义一个数组B,然后判断是不是数组B的每一项是不是都包含在数组A里面

解决方案 »

  1.   

    取列名
    DataTable dt;
    List<string> A=new List<string>();
                foreach (DataColumn dc in dt.Columns)
                {
                  A.Add(dc.ColumnName);
                }
    List<string> B=new List<string>(){.......};
    判断在不在里面,自己写个循环
    foreach(string b in B)
    {
       if(A.Contains(b))
    {
      //包含在里面
    }
    }
      

  2.   


    DataSet.Tables[0].Columns[ i ].ToString();