以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助] 这个重置列的时候会报调用目标异常的错误 找不到原因了!  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=34182)

--  作者:jiskin
--  发布时间:2013/6/1 19:12:00
--  [求助] 这个重置列的时候会报调用目标异常的错误 找不到原因了!

找不到哪里的语法不对了……

 

Select Case e.DataCol.name
    Case "零件名称","零件号","生产工艺","工艺原料","仓库_入库确认","仓库_待发确认","仓库_原材料领料完成日"
        Dim dr As DataRow = e.DataRow
        If dr.Isnull("生产工艺") = False Then
            If dr("生产工艺") = "外购成品" OrElse dr("生产工艺") = "组件" OrElse dr("生产工艺") = "库存成品" Then
                Dim pf As String = dr("零件号")
                Dim cmd1 As New SQLCommand
                Dim cmd2 As New SQLCommand
                Dim cmd3 As New SQLCommand
                cmd1.C
                cmd2.C
                cmd3.C
                If pf > "" Then
                    cmd1.commandText = "Select [库存数量] From {库存总表} Where [零件号] = \'" & pf & "\'"
                    cmd2.commandText = "Select [待发数量] From {库存总表} Where [零件号] = \'" & pf & "\'"
                    cmd3.commandText = "Select [储位] From {库存总表} Where [零件号] = \'" & pf & "\'"
                End If
                dr("仓库_库位代码") = cmd3.ExecuteScalar & " 库存:" & cmd1.ExecuteScalar - cmd2.ExecuteScalar
            Else
                Dim pf As String = dr("工艺原料")
                Dim cmd1 As New SQLCommand
                Dim cmd2 As New SQLCommand
                Dim cmd3 As New SQLCommand
                cmd1.C
                cmd2.C
                cmd3.C
                If pf > "" Then
                    cmd1.commandText = "Select [库存数量] From {库存总表} Where [零件号] = \'" & pf & "\'"
                    cmd2.commandText = "Select [待发数量] From {库存总表} Where [零件号] = \'" & pf & "\'"
                    cmd3.commandText = "Select [储位] From {库存总表} Where [零件号] = \'" & pf & "\'"
                End If
                dr("仓库_库位代码") = cmd3.ExecuteScalar & " 库存:" & cmd1.ExecuteScalar - cmd2.ExecuteScalar
            End If
        End If
End Select


--  作者:狐狸爸爸
--  发布时间:2013/6/3 8:01:00
--  

用这个分析一下,看看问题出在哪一行代码:

http://www.foxtable.com/help/topics/1485.htm