1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Data;
6
7 namespace DataSetConr
8 {
9 class Program
10 {
11
12 public static void AddDataSetData(DataSet ds)
13 {
14 ds.Reset();
15 DataTable dt = new DataTable();
16 DataColumn dc = new DataColumn("guid", typeof(Guid));
17 DataColumn dc2 = new DataColumn("show", typeof(Boolean));
18 DataColumn dc3 = new DataColumn("isnull", typeof(Boolean));
19 dt.Columns.Add(dc); dt.Columns.Add(dc2); dt.Columns.Add(dc3);
20 DataRow dr = dt.NewRow();
21 dr.BeginEdit();
22 dr["guid"] = Guid.NewGuid();
23 dr["show"] = true;
24 dr["isnull"] = false;
25 dr.EndEdit();
26 dt.Rows.Add(dr);
27 ds.Tables.Add(dt);
28 }
29
30 static void Main(string[] args)
31 {
32
33 DataSet ds = new DataSet();
34 DataSet ds2 = new DataSet();
35 AddDataSetData(ds);
36 AddDataSetData(ds2);
37 foreach (DataRow item in ds.Tables[0].Rows)
38 {
39 //查看A在B中是否存在
40 DataRow[] rows = ds2.Tables[0].Select(string.Format("show={0} and isnull={1}",item["show"].ToString(),item["isnull"].ToString()));
41 if (rows.Length==0)
42 {
43
44 }
45 }
46 }
47 }
48 }