以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- csv文件的导入(员工编号相同的不导入) (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=154308) |
-- 作者:playmal -- 发布时间:2020/9/10 16:48:00 -- csv文件的导入(员工编号相同的不导入) 版主,请帮助看看,下面代码有什么问题,不执行: Tables("考勤状况").StopRedraw Dim str As String = FileSys.ReadAllText(ProjectPath & "导入表\\部门当天详细记录.csv", Encoding.Default) Dim ary() As String = str.Split(chr(13)) Dim nms() As String = {"员工编号","姓名","组织","日期","考勤状态","迟到时长","早退总分钟","出勤时长","缺勤时长","请假时长","加班时长"} \'注意下面的循环变量从1开始,而不是从0开始,因为Excel表的第一行是标题 For i As Integer = 7 To ary.Length - 4 Dim s() As String = ary(i).Split(",") Dim bh As String = s(0).replace("""", "").trim() msgbox(bh) If DataTables("考勤状况").Find("员工编号 = \'" & bh & "\'") Is Nothing Then \'如果不存在同序号的车辆记录 Dim r As Row = Tables("考勤状况").AddNew() For m As Integer = 0 To nms.Length - 1 r(nms(m)) = s(m).replace("""", "").trim() Next End If Next Tables("考勤状况").ResumeRedraw |
-- 作者:有点蓝 -- 发布时间:2020/9/10 16:51:00 -- msgbox(ary.Length )
|
-- 作者:playmal -- 发布时间:2020/9/10 16:53:00 -- replace出错 |
-- 作者:有点蓝 -- 发布时间:2020/9/10 16:55:00 -- Dim ary() As String = str.replace(vbcr,"").Split(vblf) |