以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]代码  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=43024)

--  作者:wsxdwh
--  发布时间:2013/11/28 14:00:00
--  [求助]代码

MessageBox.Show("校对无误后必须点击<确定>按钮以保存!")
Dim mc As WinForm.ComboBox = e.Form.Controls("ComboBox4")
Dim jb As WinForm.ComboBox = e.Form.Controls("ComboBox6")
Dim xm As WinForm.ComboBox = e.Form.Controls("ComboBox5")
If e.Form.Controls("ComboBox4").text = "级别" Then
    MessageBox.Show("请选择竞赛名称/项目/级别!")
    Return
End  If
Dim dr0 As DataRow = DataTables("项目表"). Find ("竞赛名称简称 = \'" & mc.text & "\' and 竞赛项目简称 = \'"& xm.text &"\'")
Dim str As String = dr0("记录表表名")
Dim dt As DataTable = DataTables(str)
Dim dt1 As DataTable = DataTables("报名表")

Dim drs As List(of DataRow) =dt1.Select("竞赛名称 = \'" & mc.text & "\' And 项目 = \'" & xm.Text & "\' and 级别 = \'"& jb.text &"\'","组号,区号,学校")
Dim dr,fr As DataRow
For Each dr In drs
    Dim bh As String = dr("编号")
    If dt.find ("编号 = \'"& bh &"\'") Is Nothing Then
        If dr("分项") = False
            If dr("审核") = True
                Dim Ary() As String = {"编号","级别","学校","姓名","组别","项目","竞赛名称","区","辅导老师","学号"}
                fr = dt.AddNew
                For i As Integer = 0 To 9
                    fr(Ary(i)) = dr(Ary(i))
                Next
                dr("分项") = True
            Else
                Dim s1 As String = dr("区")
                Dim s2 As String = dr("学校")
                Dim s3 As String = dr("姓名")
                MessageBox.Show(s1 & s2 & s3 & "没有通过审核!")
            End  If
        End  If
    End  If
Next

 

 

以上是从报名表(外部表)导入到记录表(内部表)的代码 。导入1000行用时超过5分钟,太慢了!

请专家看看 ,帮我把代码优化一下。  谢谢!!!


--  作者:Bin
--  发布时间:2013/11/28 14:02:00
--  
试试这个 http://www.foxtable.com/help/topics/0680.htm
--  作者:wsxdwh
--  发布时间:2013/11/28 15:20:00
--  
这个不行,不能选择性导入
--  作者:Bin
--  发布时间:2013/11/28 15:21:00
--  
可以设置条件

Filter

填充条件,
请参考表达式的运算符和函数 和 条件表达式

可以设置指定列
DataCols

数据接收列,不同的列用逗号分割。

还不能满足要求吗?

--  作者:wsxdwh
--  发布时间:2013/11/28 15:30:00
--  
好的 谢谢 我试试