-- 作者:刘林
-- 发布时间:2022/12/6 21:27:00
--
Dim g As New sqlGroupTableBuilder("表1", "成绩") g.C g.filter ="学段 =\'初中\' and (免统审核 = 0 or 免统审核 is null) and 考试名称 =\'" & ccb1 & "\'" g.Groups.AddDef("考试名称") g.Groups.AddDef("单位名称") g.Groups.AddDef("年级") g.Groups.AddDef("学校班级") g.Groups.AddDef("班级全称") g.Totals.AddDef("姓名",AggregateEnum.Count,"参考人数") g.Totals.AddDef("语文_A",AggregateEnum.Average,"语文_A卷") g.Totals.AddDef("语文_B",AggregateEnum.Average,"语文_B卷") g.Totals.AddDef("语文_B+ 语文_A*0.7",AggregateEnum.Average,"语文_折合") g.Totals.AddDef("数学_A",AggregateEnum.Average,"数学_A卷") g.Totals.AddDef("数学_B",AggregateEnum.Average,"数学_B卷") g.Totals.AddDef("数学_B+ 数学_A*0.7",AggregateEnum.Average,"数学_折合") g.Totals.AddDef("英语_A",AggregateEnum.Average,"英语_A卷") g.Totals.AddDef("英语_B",AggregateEnum.Average,"英语_B卷") g.Totals.AddDef("英语_B+ 英语_A*0.7",AggregateEnum.Average,"英语_折合") g.Totals.AddDef("政治_A",AggregateEnum.Average,"政治_A卷") g.Totals.AddDef("政治_B",AggregateEnum.Average,"政治_B卷") g.Totals.AddDef("政治_B+ 政治_A*0.3",AggregateEnum.Average,"政治_折合") g.Totals.AddDef("历史_A",AggregateEnum.Average,"历史_A卷") g.Totals.AddDef("历史_B",AggregateEnum.Average,"历史_B卷") g.Totals.AddDef("历史_B+ 历史_A*0.3",AggregateEnum.Average,"历史_折合") g.Totals.AddDef("物理_A",AggregateEnum.Average,"物理_A卷") g.Totals.AddDef("物理_B",AggregateEnum.Average,"物理_B卷") g.Totals.AddDef("物理_B+ 物理_A*0.35+iif(物理实验 is null,0,物理实验)",AggregateEnum.Average,"物理_折合") g.Totals.AddDef("化学_A",AggregateEnum.Average,"化学_A卷") g.Totals.AddDef("化学_B",AggregateEnum.Average,"化学_B卷") g.Totals.AddDef("化学_B+ 化学_A*0.3+iif(化学实验 Is null,0,化学实验)",AggregateEnum.Average,"化学_折合") g.Totals.AddDef("体育_B",AggregateEnum.Average,"体育_折合") g.Totals.AddDef("物理实验",AggregateEnum.Average,"物理_实验") g.Totals.AddDef("化学实验",AggregateEnum.Average,"化学_实验") g.Totals.AddDef("生物_",AggregateEnum.Average,"生物_A卷") g.Totals.AddDef("地理_",AggregateEnum.Average,"地理_A卷") g.Totals.AddDef("生物_A*0.35",AggregateEnum.Average,"生物_折合") g.Totals.AddDef("地理_A*0.35",AggregateEnum.Average,"地理_折合") G.Totals.AddDef("体育_B",AggregateEnum.Average,"体育_B卷") g.Totals.AddDef("折总",AggregateEnum.Average,"折总平均") g.Totals.Addexp("折总分段_500以上", "Case When 折总 >= 500 Then 1 Else 0 End") g.Totals.Addexp("折总分段_460至499", "Case When 折总 >= 460 and 折总<500 Then 1 Else 0 End") g.Totals.Addexp("折总分段_400至459", "Case When 折总 >= 400 and 折总< 460 Then 1 Else 0 End") g.Totals.Addexp("折总分段_350至399", "Case When 折总 >= 350 and 折总< 400 Then 1 Else 0 End") g.Totals.Addexp("折总分段_350以下", "Case When 折总< 350 Then 1 Else 0 End") g.FromServer = True tb3.DataSource = g.BuildDataSource()
老师,二楼的方法,我理解为将红色部分去掉,再生成一个统计,生成表2,将表2并入表1,按理就实现了,这个又如何实合并入表1呢
|
-- 作者:刘林
-- 发布时间:2022/12/6 21:33:00
--
Dim g As New sqlGroupTableBuilder("表1", "成绩") g.C g.filter ="学段 =\'初中\' and (免统审核 = 0 or 免统审核 is null) and 考试名称 =\'" & ccb1 & "\'" g.Groups.AddDef("考试名称") g.Groups.AddDef("单位名称") g.Groups.AddDef("年级") g.Groups.AddDef("学校班级") g.Groups.AddDef("班级全称") g.Totals.AddDef("姓名",AggregateEnum.Count,"参考人数") g.Totals.AddDef("语文_A",AggregateEnum.Average,"语文_A卷") g.Totals.AddDef("语文_B",AggregateEnum.Average,"语文_B卷") g.Totals.AddDef("语文_B+ 语文_A*0.7",AggregateEnum.Average,"语文_折合") g.Totals.AddDef("数学_A",AggregateEnum.Average,"数学_A卷") g.Totals.AddDef("数学_B",AggregateEnum.Average,"数学_B卷") g.Totals.AddDef("数学_B+ 数学_A*0.7",AggregateEnum.Average,"数学_折合") g.Totals.AddDef("英语_A",AggregateEnum.Average,"英语_A卷") g.Totals.AddDef("英语_B",AggregateEnum.Average,"英语_B卷") g.Totals.AddDef("英语_B+ 英语_A*0.7",AggregateEnum.Average,"英语_折合") g.Totals.AddDef("政治_A",AggregateEnum.Average,"政治_A卷") g.Totals.AddDef("政治_B",AggregateEnum.Average,"政治_B卷") g.Totals.AddDef("政治_B+ 政治_A*0.3",AggregateEnum.Average,"政治_折合") g.Totals.AddDef("历史_A",AggregateEnum.Average,"历史_A卷") g.Totals.AddDef("历史_B",AggregateEnum.Average,"历史_B卷") g.Totals.AddDef("历史_B+ 历史_A*0.3",AggregateEnum.Average,"历史_折合") g.Totals.AddDef("物理_A",AggregateEnum.Average,"物理_A卷") g.Totals.AddDef("物理_B",AggregateEnum.Average,"物理_B卷") g.Totals.AddDef("物理_B+ 物理_A*0.35+iif(物理实验 is null,0,物理实验)",AggregateEnum.Average,"物理_折合") g.Totals.AddDef("化学_A",AggregateEnum.Average,"化学_A卷") g.Totals.AddDef("化学_B",AggregateEnum.Average,"化学_B卷") g.Totals.AddDef("化学_B+ 化学_A*0.3+iif(化学实验 Is null,0,化学实验)",AggregateEnum.Average,"化学_折合") g.Totals.AddDef("体育_B",AggregateEnum.Average,"体育_折合") g.Totals.AddDef("物理实验",AggregateEnum.Average,"物理_实验") g.Totals.AddDef("化学实验",AggregateEnum.Average,"化学_实验") g.Totals.AddDef("生物_",AggregateEnum.Average,"生物_A卷") g.Totals.AddDef("地理_",AggregateEnum.Average,"地理_A卷") g.Totals.AddDef("生物_A*0.35",AggregateEnum.Average,"生物_折合") g.Totals.AddDef("地理_A*0.35",AggregateEnum.Average,"地理_折合") G.Totals.AddDef("体育_B",AggregateEnum.Average,"体育_B卷") g.Totals.AddDef("折总",AggregateEnum.Average,"折总平均") g.Totals.Addexp("折总分段_500以上", "Case When 折总 >= 500 Then 1 Else 0 End") g.Totals.Addexp("折总分段_460至499", "Case When 折总 >= 460 and 折总<500 Then 1 Else 0 End") g.Totals.Addexp("折总分段_400至459", "Case When 折总 >= 400 and 折总< 460 Then 1 Else 0 End") g.Totals.Addexp("折总分段_350至399", "Case When 折总 >= 350 and 折总< 400 Then 1 Else 0 End") g.Totals.Addexp("折总分段_350以下", "Case When 折总< 350 Then 1 Else 0 End") g.FromServer = True
Dim h As New sqlGroupTableBuilder("表2", "成绩") h.C h.filter ="学段 =\'初中\' and (免统审核 = 0 or 免统审核 is null) and 考试名称 =\'" & ccb1 & "\'" h.Groups.AddDef("考试名称") h.Groups.AddDef("单位名称") h.Groups.AddDef("年级") h.Totals.AddDef("姓名",AggregateEnum.Count,"参考人数") h.Totals.AddDef("语文_A",AggregateEnum.Average,"语文_A卷") h.Totals.AddDef("语文_B",AggregateEnum.Average,"语文_B卷") h.Totals.AddDef("语文_B+ 语文_A*0.7",AggregateEnum.Average,"语文_折合") h.Totals.AddDef("数学_A",AggregateEnum.Average,"数学_A卷") h.Totals.AddDef("数学_B",AggregateEnum.Average,"数学_B卷") h.Totals.AddDef("数学_B+ 数学_A*0.7",AggregateEnum.Average,"数学_折合") h.Totals.AddDef("英语_A",AggregateEnum.Average,"英语_A卷") h.Totals.AddDef("英语_B",AggregateEnum.Average,"英语_B卷") h.Totals.AddDef("英语_B+ 英语_A*0.7",AggregateEnum.Average,"英语_折合") h.Totals.AddDef("政治_A",AggregateEnum.Average,"政治_A卷") h.Totals.AddDef("政治_B",AggregateEnum.Average,"政治_B卷") h.Totals.AddDef("政治_B+ 政治_A*0.3",AggregateEnum.Average,"政治_折合") h.Totals.AddDef("历史_A",AggregateEnum.Average,"历史_A卷") h.Totals.AddDef("历史_B",AggregateEnum.Average,"历史_B卷") h.Totals.AddDef("历史_B+ 历史_A*0.3",AggregateEnum.Average,"历史_折合") h.Totals.AddDef("物理_A",AggregateEnum.Average,"物理_A卷") h.Totals.AddDef("物理_B",AggregateEnum.Average,"物理_B卷") h.Totals.AddDef("物理_B+ 物理_A*0.35+iif(物理实验 is null,0,物理实验)",AggregateEnum.Average,"物理_折合") h.Totals.AddDef("化学_A",AggregateEnum.Average,"化学_A卷") h.Totals.AddDef("化学_B",AggregateEnum.Average,"化学_B卷") h.Totals.AddDef("化学_B+ 化学_A*0.3+iif(化学实验 Is null,0,化学实验)",AggregateEnum.Average,"化学_折合") h.Totals.AddDef("体育_B",AggregateEnum.Average,"体育_折合") h.Totals.AddDef("物理实验",AggregateEnum.Average,"物理_实验") h.Totals.AddDef("化学实验",AggregateEnum.Average,"化学_实验") h.Totals.AddDef("生物_",AggregateEnum.Average,"生物_A卷") h.Totals.AddDef("地理_",AggregateEnum.Average,"地理_A卷") h.Totals.AddDef("生物_A*0.35",AggregateEnum.Average,"生物_折合") h.Totals.AddDef("地理_A*0.35",AggregateEnum.Average,"地理_折合") h.Totals.AddDef("体育_B",AggregateEnum.Average,"体育_B卷") h.Totals.AddDef("折总",AggregateEnum.Average,"折总平均") h.Totals.Addexp("折总分段_500以上", "Case When 折总 >= 500 Then 1 Else 0 End") h.Totals.Addexp("折总分段_460至499", "Case When 折总 >= 460 and 折总<500 Then 1 Else 0 End") h.Totals.Addexp("折总分段_400至459", "Case When 折总 >= 400 and 折总< 460 Then 1 Else 0 End") h.Totals.Addexp("折总分段_350至399", "Case When 折总 >= 350 and 折总< 400 Then 1 Else 0 End") h.Totals.Addexp("折总分段_350以下", "Case When 折总< 350 Then 1 Else 0 End") h.FromServer = True
这个地方如何将表2并入表1,再绑定tb3的数据源
tb3.DataSource = g.BuildDataSource()
|
-- 作者:刘林
-- 发布时间:2022/12/8 18:26:00
--
Dim h As New sqlGroupTableBuilder("表2", "成绩") Dim dt1 As fxDataSource h.FromServer = True h.C h.filter ="学段 =\'初中\' and (免统审核 = 0 or 免统审核 is null) and 考试名称 =\'" & ccb1 & "\'" h.Groups.AddDef("考试名称") h.Groups.AddDef("单位名称") h.Groups.AddDef("年级") h.Totals.AddDef("姓名",AggregateEnum.Count,"参考人数") h.Totals.AddDef("语文_A",AggregateEnum.Average,"语文_A卷") h.Totals.AddDef("语文_B",AggregateEnum.Average,"语文_B卷") h.Totals.AddDef("语文_B+ 语文_A*0.7",AggregateEnum.Average,"语文_折合") h.Totals.AddDef("数学_A",AggregateEnum.Average,"数学_A卷") h.Totals.AddDef("数学_B",AggregateEnum.Average,"数学_B卷") h.Totals.AddDef("数学_B+ 数学_A*0.7",AggregateEnum.Average,"数学_折合") h.Totals.AddDef("英语_A",AggregateEnum.Average,"英语_A卷") h.Totals.AddDef("英语_B",AggregateEnum.Average,"英语_B卷") h.Totals.AddDef("英语_B+ 英语_A*0.7",AggregateEnum.Average,"英语_折合") h.Totals.AddDef("政治_A",AggregateEnum.Average,"政治_A卷") h.Totals.AddDef("政治_B",AggregateEnum.Average,"政治_B卷") h.Totals.AddDef("政治_B+ 政治_A*0.3",AggregateEnum.Average,"政治_折合") h.Totals.AddDef("历史_A",AggregateEnum.Average,"历史_A卷") h.Totals.AddDef("历史_B",AggregateEnum.Average,"历史_B卷") h.Totals.AddDef("历史_B+ 历史_A*0.3",AggregateEnum.Average,"历史_折合") h.Totals.AddDef("物理_A",AggregateEnum.Average,"物理_A卷") h.Totals.AddDef("物理_B",AggregateEnum.Average,"物理_B卷") h.Totals.AddDef("物理_B+ 物理_A*0.35+iif(物理实验 is null,0,物理实验)",AggregateEnum.Average,"物理_折合") h.Totals.AddDef("化学_A",AggregateEnum.Average,"化学_A卷") h.Totals.AddDef("化学_B",AggregateEnum.Average,"化学_B卷") h.Totals.AddDef("化学_B+ 化学_A*0.3+iif(化学实验 Is null,0,化学实验)",AggregateEnum.Average,"化学_折合") h.totals.AddDef("体育_B",AggregateEnum.Average,"体育_折合") h.Totals.AddDef("物理实验",AggregateEnum.Average,"物理_实验") h.Totals.AddDef("化学实验",AggregateEnum.Average,"化学_实验") h.Totals.AddDef("生物_",AggregateEnum.Average,"生物_A卷") h.Totals.AddDef("地理_",AggregateEnum.Average,"地理_A卷") h.Totals.AddDef("生物_A*0.35",AggregateEnum.Average,"生物_折合") h.Totals.AddDef("地理_A*0.35",AggregateEnum.Average,"地理_折合") h.Totals.AddDef("体育_B",AggregateEnum.Average,"体育_B卷") h.Totals.AddDef("折总",AggregateEnum.Average,"折总平均") h.Totals.Addexp("折总分段_500以上", "Case When 折总 >= 500 Then 1 Else 0 End") h.Totals.Addexp("折总分段_460至499", "Case When 折总 >= 460 and 折总<500 Then 1 Else 0 End") h.Totals.Addexp("折总分段_400至459", "Case When 折总 >= 400 and 折总< 460 Then 1 Else 0 End") h.Totals.Addexp("折总分段_350至399", "Case When 折总 >= 350 and 折总< 400 Then 1 Else 0 End") h.Totals.Addexp("折总分段_350以下", "Case When 折总< 350 Then 1 Else 0 End") dt1 = h.BuildDataSource() Dim tbl As DataTable = dt1.TodataTable()
请问老师,这里提示tabatable() 不是fxDataSource的成员,应该怎样才对
|