以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  Input string was not in a correct format.  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=147558)

--  作者:yetle
--  发布时间:2020/3/19 12:01:00
--  Input string was not in a correct format.
.NET Framework 版本:4.0.30319.1022
Foxtable 版本:2020.1.19.19
错误所在事件:窗口,原材料加工,Button16,Click
详细错误信息:
Conversion from string "物料基本信息_物料ID" to type \'Integer\' is not valid.
Input string was not in a correct format.


Dim ar =Tables("原材料加工_table2").DataTable.Select("原材料加工单号 = \'" & Tables("原材料加工_table1").current("原材料加工单号") & "\' ")
If ar IsNot Nothing  Then
MessageBox.show(1)
    For Each br As DataRow In DataTables("大货用量表").Select("用量信息_上级 = \'" & Chr(ar("物料基本信息_物料ID")) & "\' and 物供号 = \'" & ar("物供号") & "\'and 物料配色 = \'" & ar("物料配色") & "\' ")

Tables("原材料加工_table2")表和Tables("大货用量表")表里“物料基本信息_物料ID”都是字符型,为什么会有这个提示???

--  作者:有点蓝
--  发布时间:2020/3/19 13:30:00
--  
chr有什么作用?

  For Each br As DataRow In DataTables("大货用量表").Select("用量信息_上级 = \'" & ar("物料基本信息_物料ID") & "\' and 物供号 = \'" & ar("物供号") & "\'and 物料配色 = \'" & ar("物料配色") & "\' ")
--  作者:yetle
--  发布时间:2020/3/19 14:45:00
--  
就是因为有这个提示才加的,
For Each br As DataRow In DataTables("大货用量表").Select("用量信息_上级 = \'" & ar("物料基本信息_物料ID") & "\' and 物供号 = \'" & ar("物供号") & "\'and 物料配色 = \'" & ar("物料配色") & "\' ")
这么写也是有这个提示的

--  作者:有点蓝
--  发布时间:2020/3/19 14:48:00
--  
错误所在事件:窗口,原材料加工,Button16,Click

完整代码发上来