复制表的行数据 DataSet DataTable

  DataSet ds = new DataSet();
            ds.ReadXml(Application.StartupPath.ToString() + " file://SystemConfig.xml/");

            DataTable dtt = new DataTable();
            dtt=ds.Tables[0].Clone();
            DataRow[] drs = ds.Tables[0].Select("Level='网络'");
           
            foreach(DataRow dr in drs)
            {
                dtt.ImportRow(dr);
            }
            this.dataGrid1.DataSource =dtt;

你可能感兴趣的:(Datatable)