Foxtable(狐表)用户栏目专家坐堂 → [求助]求版主指点错误!


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

主题:[求助]求版主指点错误!

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/4/22 9:55:00 [显示全部帖子]

你请加入msgbox查看哪里有问题。

 

或者直接说明判断逻辑。


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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/4/22 11:24:00 [显示全部帖子]

 你不是说导入没问题,而是重置列有问题,去检查你dataColChanged的代码才对啊。

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/4/22 11:48:00 [显示全部帖子]

 请说明逻辑啊,全部是false,就说明你代码逻辑有问题啊。

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/4/22 14:27:00 [显示全部帖子]

你的excel里面的列名,有多余的空格。

 

Dim Result As DialogResult
Result = MessageBox.Show("确定要导入吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If Result = DialogResult.Yes Then
    Dim dlg As New OpenFileDialog
    dlg.Filter = "Excel文件|*.xls"
    dlg.MultiSelect = True '允许选择多个文件
    If dlg.ShowDialog =DialogResult.OK Then
        Dim Book As New XLS.Book(dlg.FileName)
        Dim Sheet As XLS.Sheet = Book.Sheets(0)
        Tables("鉴定考核表").ResumeRedraw()
        Tables("鉴定考核表").StopRedraw()
        systemready = False
        Dim nms As New Dictionary(Of String, Integer)
        Dim dic As new Dictionary(Of DataRow, Integer)
        Dim ls As new List(Of Integer)
        For c As Integer = 0 To sheet.Cols.Count - 1
            Dim cname As String = sheet(1,c).Text.replace(" ", "")
            If  DataTables("鉴定考核表").DataCols.Contains(cname) Then
                nms.Add(cname, c)
            End If

        Next
        For n As Integer = 2 To Sheet.Rows.Count -1
            Dim sfzhm As String = sheet(n,5).Text
            If sfzhm > "" Then '排除空白行
                Dim jdpc As String = sheet(n,16).Text
                Dim dr As DataRow = DataTables("鉴定考核表").Find("身份证号码 = '" & sfzhm & "' And 鉴定批次 = '" & jdpc & "'")
                If dr Is Nothing Then
                    ls.add(n)
                Else
                    dic.Add(dr, n)
                End If
            End If
        Next
        For Each key As DataRow In dic.Keys
            For Each m As String In nms.keys
                If DataTables("鉴定考核表").DataCols(m).IsBoolean Then
                    If Sheet(dic(key),nms(m)).Text = "" OrElse Sheet(dic(key),nms(m)).Text = "False" OrElse Sheet(dic(key),nms(m)).Value = 0 Then
                        key(m) = False
                    Else
                        key(m) = True
                    End If
                Else If DataTables("鉴定考核表").DataCols(m).Expression > "" Then
                    '表达式列
                Else If DataTables("鉴定考核表").DataCols(m).IsNumeric Then
                    key(m) = val(Sheet(dic(key),nms(m)).Value)
                Else
                    key(m) = Sheet(dic(key),nms(m)).Value
                End If
            Next
        Next
        For Each l As Integer In ls
            Dim ndr As DataRow = DataTables("鉴定考核表").AddNew
            For Each m As String In nms.keys
                If DataTables("鉴定考核表").DataCols(m).IsBoolean Then
                    If Sheet(l,nms(m)).Text = "" OrElse Sheet(l,nms(m)).Text = "False" OrElse Sheet(l,nms(m)).Value = 0 Then
                        ndr (m) = False
                    Else
                        ndr (m) = True
                    End If
                Else If DataTables("鉴定考核表").DataCols(m).Expression > "" Then
                    '表达式列
                Else If DataTables("鉴定考核表").DataCols(m).IsNumeric Then
                    ndr (m) = val(Sheet(l,nms(m)).Value)
                Else
                   
                    ndr (m) = Sheet(l,nms(m)).Value
                End If
            Next
        Next
        Tables("鉴定考核表").ResumeRedraw()
        systemready = True
    End If
End If


 回到顶部