以下是导入数据的代码,现在想在导入前排序,代码如何修改? 请指教!!!
要排序的表及行为:DataTables("" & xzb.Text & "").Select("竞赛名称 = '"& jsmc.text &"' and 参赛项目 = '"& xm.text &"' and 中小学 = '" & zxx.Text & "'")
排序的方法为:Tables(e.Form.Name & "_Table2").Sort)
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")
Dim Ary As String()
For Each Ary In dt_jilu .GetUniqueValues("竞赛名称 = '"& jsmc.text &"' and 中小学= '" & zxx.text & "' and 参赛项目 = '"& xm.text &"'","竞赛名称", "编号", "中小学", "学校", "姓名", "成绩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