经测试 还是不行,成绩表被以编号为升序排序 ???
If MessageBox.Show("是否汇总到成绩表?","确认",MessageBoxButtons.OKCancel,MessageBoxIcon.Question) =DialogResult.OK Then
Dim jsmc As WinForm.ComboBox = e.Form.Controls("竞赛名称")
Dim xzb As WinForm.ComboBox = e.Form.Controls("选择表")
Dim dt_jilu As DataTable = DataTables(""& xzb.text & "")
Dim xm As WinForm.ComboBox = e.Form.Controls("项目")
Dim dt_baoming As DataTable = DataTables("报名表")
Dim dt_chengji As DataTable = DataTables("成绩表")
Dim zxx As WinForm.ComboBox = e.Form.Controls("中小学1")
DataTables("临时成绩表").DataRows.Clear
For Each dr1 As DataRow In DataTables(""& xzb.text & "").Select("竞赛名称 = '"& jsmc.text &"' and 参赛项目 = '"& xm.text &"' and 中小学 = '" & zxx.Text & "'",Tables(e.Form.Name & "_Table2").Sort)
Dim dr2 = DataTables("临时成绩表").AddNew()
dr2("竞赛名称") = dr1("竞赛名称")
dr2("编号") = dr1("编号")
dr2("中小学") = dr1("中小学")
dr2("学校") = dr1("学校")
dr2("姓名") = dr1("姓名")
dr2("成绩1") = dr1("成绩1")
dr2("成绩2") = dr1("成绩2")
dr2("奖项") = dr1("奖项")
dr2("时间排序") = dr1("时间排序")
Next
Dim Ary As String()
For Each Ary In DataTables("临时成绩表").GetUniqueValues("","竞赛名称", "编号", "中小学", "学校", "姓名", "成绩1", "成绩2","奖项","时间排序")
Dim flt As String = "编号 = '" & ary(1) & "' And 竞赛名称 = '" & ary(0) & "'"
If dt_chengji.Find(flt) Is Nothing Then
Dim ndr As DataRow = dt_chengji.AddNew
ndr("竞赛名称") = ary(0)
ndr("编号") = ary(1)
ndr("中小学") = ary(2)
ndr("学校") = ary(3)
ndr("姓名") = ary(4)
ndr("成绩1") = ary(5)
ndr("成绩2") = ary(6)
ndr("奖项") = ary(7)
ndr("时间排序") = ary(8)
Dim dr As DataRow = dt_baoming.Find("编号 = " & ary(1))
If dr IsNot Nothing Then
ndr("区") = dr("区")
ndr("参赛项目") = dr("参赛项目")
ndr("辅导教师") = dr("辅导教师")
End If
End If
Next
End If
DataTables("成绩表").Save()
DataTables("成绩表").AllowEdit =False
此主题相关图片如下:ukpfveq5yu%p5el)aiqh41.jpg
此主题相关图片如下:p90jp~@3ap`ltqishh70wh.jpg