以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 请帮忙确认对于造型说明无效的字符值 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=146310) |
-- 作者:benwong2013 -- 发布时间:2020/2/21 9:20:00 -- 请帮忙确认对于造型说明无效的字符值 在运行以下代码时候,出现问题,已经查到之是这个问题但不知道应该如何修改: .NET Framework 版本:4.0.30319.42000 Foxtable 版本:2020.1.12.18 错误所在事件: 详细错误信息: 对于造型说明无效的字符值 For p As Integer = 0 To tCols.Length -1 fr(tCols(p)) = dr(tCols(p)) Next 完整代码为: Dim i As Integer Dim o As IntegerDim f As Integer Dim prb As WinForm.ProgressBar = e.Form.Controls("ProgressBar1") Dim sCols() As String = {"日期","时间","工号尾数","体温","工号","姓名","记录人","复工日期","体温监测点","监测时间段","年月","日","考勤班次"} Dim tCols() As String = {"时间","工号尾数","体温","姓名","记录人","复工日期","体温监测点","监测时间段","年月","日"} prb.Visible = True prb.Maximum = DataTables("体温签到数据").Compute("Count(工号)","是否上传 = False") For Each dr As Row In Tables("体温签到数据").Rows If dr("是否上传") = False Then Dim fr As DataRow = DataTables("H_BackManList").SQLFind("工号 = \'"& dr("工号") &"\' And 考勤班次 = \'"& dr("考勤班次") &"\' And 日期 = \'"& dr("日期") &"\'") If fr Is Nothing Then MessageBox.Show("C") Dim nr As DataRow = DataTables("H_BackManList").AddNew For l As Integer = 0 To sCols.Length -1 nr(sCols(l)) = dr(sCols(l)) Next nr("上传时间") = DateTime.Now nr.Save o = o + 1 Else MessageBox.Show("D") For p As Integer = 0 To tCols.Length -1 fr(tCols(p)) = dr(tCols(p)) Next fr("上传时间") = DateTime.Now fr.Save f = f + 1 End If i = i + 1 prb.Value = i dr("是否上传") = True dr.save End If Next MessageBox.Show("体温数据已上传,其中新数据" & o & "个,覆盖原数据" & f & "个","温馨提示") |
-- 作者:有点蓝 -- 发布时间:2020/2/21 9:26:00 -- 检查一下电脑系统的日期格式:https://jingyan.baidu.com/article/1612d5008a67b4e20e1eeeda.html 格式改为yyyy-MM-dd,不要使用斜杆,不要出现上下午、星期几这种字符
|
-- 作者:benwong2013 -- 发布时间:2020/2/21 10:14:00 -- 修改了还是一样,另外若执行这一段代码的时候是没有问题, If fr Is Nothing Then MessageBox.Show("C") Dim nr As DataRow = DataTables("H_BackManList").AddNew For l As Integer = 0 To sCols.Length -1 nr(sCols(l)) = dr(sCols(l)) Next nr("上传时间") = DateTime.Now nr.Save o = o + 1 只有执行这段代码的时候才出现问题 MessageBox.Show("D")
For p As Integer = 0 To tCols.Length -1 fr(tCols(p)) = dr(tCols(p)) Next fr("上传时间") = DateTime.Now fr.Save f = f + 1 End If i = i + 1 prb.Value = i dr("是否上传") = True dr.save |
-- 作者:有点蓝 -- 发布时间:2020/2/21 10:23:00 -- 代码看不出有什么问题,上传实例测试 |