以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=92837)

--  作者:zzghty
--  发布时间:2016/11/14 17:27:00
--  [求助]

表事件

 

坏换货明细表_DataColChanged

 

If e.DataCol.Name = "换货品名" AndAlso e.DataRow("换货品名") = True Then

    Dim nma() As String = {"类别","换货品名","数量"} \'A表数据来源列

    Dim nmb() As String = {"类别","品名","数量"} \'B表数据接收列

    Dim dr As DataRow = DataTables("数据汇总表").AddNew

    For i As Integer = 0 To nma.Length - 1

        dr(nmb(i)) = e.DataRow(nma(i))

    Next

End If


这是我写的一个代码,目的是修改坏换货明细表的换货品名一列时,自动在数据汇总表中增加类别、品名和数量这三列,但是运行起来总是报错如下


.NET Framework 版本:2.0.50727.5485

Foxtable 版本:2016.7.29.1

错误所在事件:表,坏换货明细表,DataColChanged

详细错误信息:

Exception has been thrown by the target of an invocation.

从字符串“LED 60SMD E14 3.5W”到类型“Boolean”的转换无效。

Input string was not in a correct format.”


请问我的列的类型不对吗?我查看了一下,应该都是字符型的,没有错啊。



--  作者:有点蓝
--  发布时间:2016/11/14 17:31:00
--  
If e.DataCol.Name = "换货品名" AndAlso e.DataRow.Isnull("换货品名") = False Then
    Dim nma() As String = {"类别","换货品名","数量"} \'A表数据来源列
    Dim nmb() As String = {"类别","品名","数量"} \'B表数据接收列
    Dim dr As DataRow = DataTables("数据汇总表").AddNew
    For i As Integer = 0 To nma.Length - 1
        dr(nmb(i)) = e.DataRow(nma(i))
    Next
End If


--  作者:zzghty
--  发布时间:2016/11/14 18:54:00
--  
以下是引用有点蓝在2016/11/14 17:31:00的发言:
If e.DataCol.Name = "换货品名" AndAlso e.DataRow.Isnull("换货品名") = False Then
    Dim nma() As String = {"类别","换货品名","数量"} \'A表数据来源列
    Dim nmb() As String = {"类别","品名","数量"} \'B表数据接收列
    Dim dr As DataRow = DataTables("数据汇总表").AddNew
    For i As Integer = 0 To nma.Length - 1
        dr(nmb(i)) = e.DataRow(nma(i))
    Next
End If


非常感谢,已经不报错了,但是,表b中并没有增加任何新的数据,请问是怎么回事?


--  作者:有点蓝
--  发布时间:2016/11/14 20:00:00
--  
这段代码没有问题,看看是不是其它代码的原因。
--  作者:zzghty
--  发布时间:2016/11/14 20:56:00
--  
以下是引用有点蓝在2016/11/14 20:00:00的发言:
这段代码没有问题,看看是不是其它代码的原因。
非常感谢,我找到问题了,可以增加记录了。