Dim dtb As New DataTableBuilder("全刀统计")
dtb.AddDef("全刀医师", Gettype(String), 16)
Dim prds As List(of String) = DataTables("患者信息").GetValues("手术类型")
For Each prd As String In prds
dtb.AddDef(prd & "_全刀台次", Gettype(Integer))
dtb.AddDef(prd & "_全刀费", Gettype(Double))
Next
dtb.Build()
For Each cus As String In DataTables("患者信息").GetValues("全刀医师")
Dim dr As DataRow = DataTables("全刀统计").AddNew()
dr("全刀医师") = cus
For Each prd As String In prds
dr(prd & "_全刀台次") = DataTables("患者信息").Compute("Count(患者姓名)","全刀医师 = '" & cus & "' And [手术类型] = '" & prd & "'")
dr(prd & "_全刀费") = DataTables("患者信息").Compute("Sum(全刀手术费)","全刀医师 = '" & cus & "' And [手术类型] = '" & prd & "'")
Next
Next
Tables("工作量计_Table1").DataSource = DataTables("全刀统计")
这个代码看上去没错 可以统计出数据,但是,只能点击一次,点击第二次执行后,会闪退,应该是存在一个临时表的原因吧,怎么解决!!!