Foxtable(狐表)用户栏目专家坐堂 → [分享] 窗口表导入EXCEL数据


  共有4743人关注过本帖树形打印复制链接

主题:[分享] 窗口表导入EXCEL数据

帅哥哟,离线,有人找我吗?
zyqzyy
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:822 积分:5879 威望:0 精华:0 注册:2013/7/29 12:00:00
  发帖心情 Post By:2014/6/27 23:57:00 [显示全部帖子]

Dim TableName As String = "窗口2_Table1"
Dim dlg As New OpenFileDialog '定义一个新的OpenFileDialog
dlg.Filter = "Excel文件|*.xls|Word文件|*.doc|Access文件|*.mdb"
If dlg.ShowDialog = DialogResult.OK Then '如果用户单击了确定按钮
    Dim Book As New XLS.Book(dlg.FileName)
    Dim Sheet As XLS.Sheet = Book.Sheets(0)
    Tables(TableName).StopRedraw()
    Dim dtb As New DataTableBuilder("统计")
    For n1 As Integer = 1 To Sheet.Cols.Count - 1
        dtb.AddDef(Sheet(0, n1).Text, Gettype(String), 32)
    Next
    Tables(TableName).DataSource = dtb.BuildDataSource
    For n As Integer = 1 To Sheet.Rows.Count - 1
        Dim bh As String = Sheet(n, 0).Text
        Dim dr As Row = Tables(TableName).AddNew()
        For m As Integer = 0 To Tables(TableName).Cols.Count - 1
            dr(Tables(TableName).Cols(m)) = Sheet(n, m).Value
        Next
    Next
End If
Tables(TableName).ResumeRedraw()

 回到顶部
帅哥哟,离线,有人找我吗?
zyqzyy
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:822 积分:5879 威望:0 精华:0 注册:2013/7/29 12:00:00
  发帖心情 Post By:2014/6/28 0:21:00 [显示全部帖子]

请教楼主,如何与外部表对比后导入不重复的记录?


 回到顶部