Foxtable(狐表)用户栏目专家坐堂 → [求助]无法解释位置 5 的标记


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

主题:[求助]无法解释位置 5 的标记

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/4/19 8:50:00 [显示全部帖子]

Dim dlg As New OpenFileDialog
dlg.Filter = "Excel文件|*.xls;*.xlsx"
If dlg.ShowDialog =DialogResult.OK Then
    Dim Book As New XLS.Book(dlg.FileName)
    For Each sheet As xls.sheet In book.sheets
        If DataTables.Contains(sheet.name)=True Then
            Dim t As Table = Tables(sheet.name)
            t.ResumeRedraw()
            t.StopRedraw()
            For n As Integer =2  To Sheet.Rows.Count -4
                Dim cnames As String="1=1"
                For i As Integer = 0 To sheet.Cols.Count -1
                    cnames &= " and " & sheet(1, i).text.replace("/", "") & "=" & "'" & Sheet(n,i).text & "'"
                Next
                MessageBox.Show(cnames)
                Dim drs As DataRow=DataTables(sheet.name).Find(cnames)
                MessageBox.Show(1)
                If drs Is Nothing Then
                    Dim r As DataRow= t.DataTable.AddNew()
                    For i As Integer = 0 To sheet.Cols.Count -1
                        Dim cname As String = sheet(1, i).text.replace("/", "")
                        If cname > "" AndAlso t.Cols.Contains(cname) Then
                            r(cname)= sheet(n, i).Text
                        End If
                    Next
                End If
            Next
           
            t.ResumeRedraw()
        End If
    Next
   
End If

 回到顶部