以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 输入字符串的格式不正确 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=125496) |
-- 作者:yetle -- 发布时间:2018/9/29 14:46:00 -- 输入字符串的格式不正确 .NET Framework 版本:2.0.50727.3655 Foxtable 版本:2018.9.9.1 错误所在事件:窗口,销售订单,Button11,Click 详细错误信息: 输入字符串的格式不正确。不能在 衣裤尺码明细_XS 列中存储 <>。所需类型是 Int32。 输入字符串的格式不正确。 Dim dt2 As DataTable = DataTables("销售明细尺码") Dim dt1 As DataTable = Tables("销售订单_table5").DataTable For Each drr As DataRow In dt1.DataRows Dim fdr As DataRow = dt2.Find("款号ID = \'" & drr("款号ID") & "\' ") If Tables("销售订单_table5").Cols.Contains("尺码_XS") Then \'如果销售订单_table5中存在尺码_XS列 fdr("衣裤尺码明细_XS")=drr("尺码_XS") \'则将drr中尺码_XS的值赋给fdr衣裤尺码明细_XS End If next
[此贴子已经被作者于2018/9/29 14:45:52编辑过]
|
-- 作者:有点蓝 -- 发布时间:2018/9/29 15:17:00 -- For Each drr As DataRow In dt1.DataRows Dim fdr As DataRow = dt2.Find("款号ID = \'" & drr("款号ID") & "\' ") If fdr IsNot Nothing AndAlso Tables("销售订单_table5").Cols.Contains("尺码_XS") Then \'如果销售订单_table5中存在尺码_XS列 msgbox(drr("尺码_XS")) \'出错前这里是什么内容 fdr("衣裤尺码明细_XS")=drr("尺码_XS") \'则将drr中尺码_XS的值赋给fdr衣裤尺码明细_XS End If Next
|
-- 作者:yetle -- 发布时间:2018/9/29 15:51:00 -- 没有提示呢,我上传实例 [此贴子已经被作者于2018/9/30 14:54:35编辑过]
|
-- 作者:有点蓝 -- 发布时间:2018/9/29 16:04:00 -- 全部赋值的地方都改改 这种直接写个循环赋值就可以,没有必要一个尺码几行代码 For Each drr As DataRow In dt1.DataRows Dim str As String = "XS,S,M,........." Dim t As Table = Tables("销售订单_table2") For Each s As String In str.Split(",") If t.Cols.Contains("尺码_" & s) Then fdr("衣裤尺码明细_XS")=val(drr("尺码_" & s)) End If Next Next |
-- 作者:yetle -- 发布时间:2018/9/30 9:05:00 -- 按老师的代码改了一下实例,有个错误提示,请帮我看看 [此贴子已经被作者于2018/9/30 14:54:25编辑过]
|
-- 作者:有点蓝 -- 发布时间:2018/9/30 10:20:00 -- Dim tbl As Table = Tables("销售订单_table3") Tables("销售订单_table2").Filter = "[款号ID] = \'" & tbl.current("款号ID") & "\'" \' 对比更新 Dim dt2 As DataTable = DataTables("横向销售明细尺码") Dim dt1 As DataTable = Tables("销售订单_table2").DataTable Dim t As Table = Tables("销售订单_table2") Dim str1 As String = "XS,S,M,L,XL,2XL,3XL,4XL,5XL,6XL,F,XF" Dim str2 As String = "65,70,75,80,85,9095,100" For Each drr As DataRow In dt1.DataRows Dim fdr As DataRow = dt2.Find("款号ID = \'" & drr("款号ID") & "\' ") If fdr IsNot Nothing Then For Each s As String In str1.Split(",") If t.Cols.Contains("尺码_" & s) Then fdr("衣裤尺码明细_" & s)=val(drr("尺码_" & s)) End If Next For Each s As String In str2.Split(",") If t.Cols.Contains("尺码_" & s) Then fdr("文胸尺码明细_" & s)=val(drr("尺码_" & s)) End If Next Tables("销售订单_table2").Filter = "[款号ID] = \'" & tbl.current("款号ID") & "\'" Else Dim dr1 As Row = Tables("横向销售明细尺码").AddNew dr1("订单号")=drr("订单号") dr1("款号")=drr("款号") dr1("颜色")=drr("颜色") dr1("杯型")=drr("杯型") dr1("货期")=drr("货期") dr1("款号ID")=drr("款号ID") dr1("物供号")=drr("物供号") dr1.Save() Syscmd.Table.Lock() Tables("销售订单_table2").Filter = "[款号ID] = \'" & tbl.current("款号ID") & "\'" End If Next
|
-- 作者:yetle -- 发布时间:2018/9/30 10:39:00 -- 这样是没有报错了,可是对应尺码的数量取值不对 也只有一行记录出来
[此贴子已经被作者于2018/9/30 10:42:19编辑过]
|
-- 作者:有点蓝 -- 发布时间:2018/9/30 11:11:00 -- Dim tbl As Table = Tables("销售订单_table3") Tables("销售订单_table2").Filter = "[款号ID] = \'" & tbl.current("款号ID") & "\'" \' 对比更新 Dim dt2 As DataTable = DataTables("横向销售明细尺码") Dim dt1 As DataTable = Tables("销售订单_table2").DataTable Dim t As Table = Tables("销售订单_table2") Dim str1 As String = "XS,S,M,L,XL,2XL,3XL,4XL,5XL,6XL,F,XF" Dim str2 As String = "65,70,75,80,85,9095,100" For Each drr As DataRow In dt1.DataRows Dim fdr As DataRow = dt2.Find("款号ID = \'" & drr("款号ID") & "\' ") If fdr IsNot Nothing Then For Each s As String In str1.Split(",") If t.Cols.Contains("尺码_" & s) Then fdr("衣裤尺码明细_" & s)=val(drr("尺码_" & s)) End If Next For Each s As String In str2.Split(",") If t.Cols.Contains("尺码_" & s) Then fdr("文胸尺码明细_" & s)=val(drr("尺码_" & s)) End If Next End If Dim dr1 As Row = Tables("横向销售明细尺码").AddNew dr1("订单号")=drr("订单号") dr1("款号")=drr("款号") dr1("颜色")=drr("颜色") dr1("杯型")=drr("杯型") dr1("货期")=drr("货期") dr1("款号ID")=drr("款号ID") dr1("物供号")=drr("物供号") Next Syscmd.Table.Lock() Tables("横向销售明细尺码").save Tables("销售订单_table2").Filter = "[款号ID] = \'" & tbl.current("款号ID") & "\'" [此贴子已经被作者于2018/9/30 11:11:08编辑过]
|
-- 作者:yetle -- 发布时间:2018/9/30 11:17:00 -- 有多行记录出来了,可是fdr IsNot Nothing 没有起作用,重复新增了记录,同时尺码数量没有取到 [此贴子已经被作者于2018/9/30 11:17:27编辑过]
|
-- 作者:有点蓝 -- 发布时间:2018/9/30 11:31:00 -- …… For Each drr As DataRow In dt1.DataRows Dim fdr As DataRow = dt2.Find("款号ID = \'" & drr("款号ID") & "\' ") If fdr IsNot Nothing Then For Each s As String In str1.Split(",") If t.Cols.Contains("尺码_" & s) Then fdr("衣裤尺码明细_" & s)=val(drr("尺码_" & s)) End If Next For Each s As String In str2.Split(",") If t.Cols.Contains("尺码_" & s) Then fdr("文胸尺码明细_" & s)=val(drr("尺码_" & s)) End If Next Dim dr1 As Row = Tables("横向销售明细尺码").AddNew dr1("订单号")=drr("订单号") dr1("款号")=drr("款号") dr1("颜色")=drr("颜色") dr1("杯型")=drr("杯型") dr1("货期")=drr("货期") dr1("款号ID")=drr("款号ID") dr1("物供号")=drr("物供号") End IfNext ……
|