Foxtable(狐表)用户栏目专家坐堂 → 求一对比小程序


  共有10339人关注过本帖树形打印复制链接

主题:求一对比小程序

帅哥哟,离线,有人找我吗?
don
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1812 积分:12999 威望:0 精华:14 注册:2008/10/11 18:07:00
  发帖心情 Post By:2012/6/15 15:40:00 [显示全部帖子]

SQL法:

Dim dt1,dt2,dt3 As DataTable
Dim sql1,sql2,sql3 As String

dt1 = DataTables("窗口2_Table1")
sql1 = "SELECT 人员 as  AB都有 ,'' as A有B无,'' as A无B有  FROM {表A} WHERE 人员 IN (SELECT 人员 FROM {表B})"
sql2 = "SELECT 人员 as  A有B无  FROM {表A} WHERE 人员 Not IN (SELECT 人员 FROM {表B})"
sql3 = "SELECT 人员 as  A无B有  FROM {表B} WHERE 人员 Not IN (SELECT 人员 FROM {表A})"

Dim cmd2,cmd3 As New SQLCommand
cmd2.CommandText = sql2
dt2 = cmd2.ExecuteReader()

cmd3.CommandText = sql3
dt3 = cmd3.ExecuteReader()
dt1.Fill(sql1,"",True)

Dim f As New Filler
f.SourceTable = dt2  
f.DataTable = dt1
f.Append = False
f.Fill() '

f = New Filler
f.SourceTable = dt3  
f.DataTable = dt1
f.Append = False
f.Fill() '

 回到顶部