Select Case e.DataCol.name
Case "装配piao号","类型","SO号","箱号","SO行号","制造产品号","计划数量"
Dim ph As String
Dim lx As String
Dim soh As String
Dim xh As String
Dim sohh As String
Dim cph As String
Dim sl As byte
If e.DataCol.Name= "装配piao号" Then
ph = e.NewValue
lx = e.DataRow("类型")
soh = e.DataRow("SO号")
xh = e.DataRow("箱号")
sohh = e.DataRow("SO行号")
cph = e.DataRow("制造产品号")
sl = e.DataRow("计划数量")
Elseif e.DataCol.Name= "类型" Then
lx = e.NewValue
ph = e.DataRow("装配piao号")
soh = e.DataRow("SO号")
xh = e.DataRow("箱号")
sohh = e.DataRow("SO行号")
cph = e.DataRow("制造产品号")
sl = e.DataRow("计划数量")
Elseif e.DataCol.Name= "SO号" Then
soh = e.NewValue
ph = e.DataRow("装配piao号")
lx = e.DataRow("类型")
xh = e.DataRow("箱号")
sohh = e.DataRow("SO行号")
cph = e.DataRow("制造产品号")
sl = e.DataRow("计划数量")
Elseif e.DataCol.Name= "箱号" Then
xh = e.NewValue
ph = e.DataRow("装配piao号")
soh = e.DataRow("SO号")
lx = e.DataRow("类型")
sohh = e.DataRow("SO行号")
cph = e.DataRow("制造产品号")
sl = e.DataRow("计划数量")
Elseif e.DataCol.Name= "SO行号" Then
sohh = e.NewValue
ph = e.DataRow("装配piao号")
soh = e.DataRow("SO号")
lx = e.DataRow("类型")
xh = e.DataRow("箱号")
cph = e.DataRow("制造产品号")
sl = e.DataRow("计划数量")
Elseif e.DataCol.Name= "制造产品号" Then
cph = e.NewValue
ph = e.DataRow("装配piao号")
soh = e.DataRow("SO号")
lx = e.DataRow("类型")
xh = e.DataRow("箱号")
sohh = e.DataRow("SO行号")
sl = e.DataRow("计划数量")
Elseif e.DataCol.Name= "数量" Then
sl = e.NewValue
ph = e.DataRow("装配piao号")
soh = e.DataRow("SO号")
lx = e.DataRow("类型")
xh = e.DataRow("箱号")
sohh = e.DataRow("SO行号")
sl = e.DataRow("计划数量")
End If
If ph > "" AndAlso lx > "" AndAlso soh > "" AndAlso xh > "" AndAlso sohh > "" AndAlso cph > "" AndAlso sl > "" Then
Dim dr As DataRow = e.DataRow
If e.DataTable.SqlFind("装配piao号 = '" & ph & "' And 类型 = '" & lx & "' And SO号 = '" & soh & "' And 箱号 = '" & xh & "' And SO行号 = '" & sohh & "'And 制造产品号 = '" & cph & "'And 计划数量 = '" & sl & "'") IsNot Nothing Then
MessageBox.Show("已经存在相同piao号/类型/SO号/箱号/SO行号/产品号/数量的行!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
e.Cancel = True
End If
End If
End Select
这是我的代码,放在datacolchanging里面。但是,使用的时候,会出现如下警告:
.NET Framework 版本:2.0.50727.8793
Foxtable 版本:2017.3.18.1
错误所在事件:表,JPK612任务单,DataColChanging
详细错误信息:
调用的目标发生了异常。
从字符串“”到类型“Double”的转换无效。
输入字符串的格式不正确。
而且,7列数据全部都输入进入了。为什么呢?