对两个数据库中的两个表进行联合查询(2)
来源:未知 责任编辑:责任编辑 发表时间:2014-01-26 21:59 点击:次
26: sda2.Fill(ds, "stu2");
27:
28: var query = from stu in ds.Tables["stu1"].AsEnumerable()
29: from sc in ds.Tables["stu2"].AsEnumerable()
30: where stu.Field<int>("sc") == sc.Field<int>("sc")
31: select new
32: {
33: sno = stu.Field<int>("sno",DataRowVersion.Original),
34: sname=stu.Field<string>("sname",DataRowVersion.Original),
35: sage = stu.Field<int>("sage", DataRowVersion.Original),
36: scname = sc.Field<string>("scname", DataRowVersion.Original)
37: };
38:
39: DataTable dt = new DataTable();
40: dt.Columns.Add("sno", typeof(int));
41: dt.Columns.Add("sname", typeof(string));
42: dt.Columns.Add("sage", typeof(string));
43: dt.Columns.Add("scname", typeof(string));
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>