以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  导入excel合并数据是提示该字符串未被识别为有效的布尔值(已解决)!  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=126995)

--  作者:lunengcheng
--  发布时间:2018/11/2 13:28:00
--  导入excel合并数据是提示该字符串未被识别为有效的布尔值(已解决)!
老师好,我用论坛里的这段代码导入合并数据到表时,提示这个错误,我的excel表里面有逻辑列,不知道怎样才能把这个给转换修正一下掉!

Dim dlg As New OpenFileDialog
dlg.Filter = "Excel文件|*.xls;*.xlsx"
If dlg.ShowDialog =DialogResult.OK Then
    Dim t As Table = Tables("数据表")
    \'t.StopRedraw()
    Dim Book As New XLS.Book(dlg.FileName)
    Dim Sheet As XLS.Sheet = Book.Sheets(0)
    Dim newcount As Integer = 0
    Dim oldcount As Integer = 0
    For n As Integer = 1 To Sheet.Rows.Count -1
        Dim r As DataRow = t.DataTable.Find("编号 = \'" & sheet(n, 1).text & "\'")
        If r Is Nothing Then
            r = t.DataTable.AddNew()
            newcount += 1
        Else
            oldcount += 1
        End If
        For i As Integer = 0 To sheet.Cols.Count -1
            Dim cname As String = sheet(0, i).text
            If t.Cols.Contains(cname) Then
                r(cname) = sheet(n, i).Text
            End If
        Next
    Next
    msgbox("新增" & newcount & "    " & "更新旧数据" & oldcount)
    \'t.ResumeRedraw()
End If


提示错误如下:

.NET Framework 版本:2.0.50727.8670
Foxtable 版本:2018.9.9.1
错误所在事件:自定义函数Translate_TableMenu
详细错误信息:
调用的目标发生了异常。
该字符串未被识别为有效的布尔值。不能在 锁定表 列中存储 <1>。所需类型是 Boolean。
该字符串未被识别为有效的布尔值。

[此贴子已经被作者于2018/11/2 16:07:44编辑过]

--  作者:有点甜
--  发布时间:2018/11/2 15:42:00
--  

参考

 

http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=123476&skin=0

 


--  作者:lunengcheng
--  发布时间:2018/11/2 16:07:00
--  
使用上面参考链接的代码,已经解决,多谢老师!