以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]还是代码简化 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=160811) |
-- 作者:cqlpjks -- 发布时间:2021/2/22 22:20:00 -- [求助]还是代码简化 Dim Values() As String = {"总分"} Dim s1() As String = New String() {"总分"} Dim dt As Table = Tables("成绩库") Dim lm1s() As String = {"序号","部别","年级","科目"} Dim lm2s() As String = {"参考人数","平均分","标准差"} Dim dhs() As String = {"重点A","本科A","专科A"} Dim lm3s() As String = {"平均分","标准差","平均分之和","标准差之和","目标","重点线","有效分"} Dim tjnj As String = 2018 For Each Value As String In Values Dim dtb As New DataTableBuilder( value & tjnj & "级有效分") For Each lm1 As String In lm1s dtb.AddDef( lm1 ,Gettype(String),8) Next For Each lm2 As String In lm2s dtb.AddDef( lm2 ,Gettype(Double)) Next For Each lm3 As String In lm3s For Each dh As String In dhs For i As Integer = 1 To 7 dtb.AddDef( dh & i ,Gettype(Double),"", dh & "_ "& lm3 &"") Next Next Next dtb.Build() Next 执行代码报错: 红色部分代码是下面代码的简化: dtb.AddDef("重点A1",Gettype(Double),"","重点A及以上_平均分") dtb.AddDef("重点A2",Gettype(Double),"","重点A及以上_标准差") dtb.AddDef("重点A3",Gettype(Double),"","重点A及以上_平均分之和") dtb.AddDef("重点A4",Gettype(Double),"","重点A及以上_标准差之和") dtb.AddDef("重点A5",Gettype(Double),"","重点A及以上_目标") dtb.AddDef("重点A6",Gettype(Double),"","重点A及以上_重点线") dtb.AddDef("重点A7",Gettype(Double),"","重点A及以上_有效分") dtb.AddDef("本科A1",Gettype(Double),"","本科A及以上_平均分") dtb.AddDef("本科A2",Gettype(Double),"","本科A及以上_标准差") dtb.AddDef("本科A3",Gettype(Double),"","本科A及以上_平均分之和") dtb.AddDef("本科A4",Gettype(Double),"","本科A及以上_标准差之和") dtb.AddDef("本科A5",Gettype(Double),"","本科A及以上_目标") dtb.AddDef("本科A6",Gettype(Double),"","本科A及以上_本科线") dtb.AddDef("本科A7",Gettype(Double),"","本科A及以上_有效分") dtb.AddDef("专科A1",Gettype(Double),"","专科A及以上_平均分") dtb.AddDef("专科A2",Gettype(Double),"","专科A及以上_标准差") dtb.AddDef("专科A3",Gettype(Double),"","专科A及以上_平均分之和") dtb.AddDef("专科A4",Gettype(Double),"","专科A及以上_标准差之和") dtb.AddDef("专科A5",Gettype(Double),"","专科A及以上_目标") dtb.AddDef("专科A6",Gettype(Double),"","专科A及以上_专科线") dtb.AddDef("专科A7",Gettype(Double),"","专科A及以上_有效分") 建表样式: 如何修改红色部分代码?请指教,谢谢! [此贴子已经被作者于2021/2/22 22:26:23编辑过]
|
-- 作者:cqlpjks -- 发布时间:2021/2/22 22:35:00 -- 解决了。谢谢! dtb.AddDef( dh & lm3 ,Gettype(Double),"", dh & "及以上_ "& lm3 &"")
|
-- 作者:有点蓝 -- 发布时间:2021/2/22 22:40:00 -- Dim dtb As New DataTableBuilder("总分2018级有效分") Dim lm1s() As String = {"序号","部别","年级","科目","参考人数","平均分","标准差"} For Each lm1 As String In lm1s dtb.AddDef( lm1 ,Gettype(String),8) Next Dim dhs() As String = {"重点A","本科A","专科A"} Dim lm3s() As String = {"平均分","标准差","平均分之和","标准差之和","目标","重点线","有效分"} For Each dh As String In dhs For i As Integer = 0 To lm3s.length - 1 dtb.AddDef( dh & (i+1) ,Gettype(Double),"", dh & "及以上_" & lm3s(i)) Next Next dtb.Build() |