以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  代码  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=56679)

--  作者:爱相随
--  发布时间:2014/9/10 17:06:00
--  代码
老师,麻烦帮我看一下这段代码错在哪里呢。谢谢!!
If User.IsRole("付款人") Then
    For Each r As Row In Tables("ZJSQB").GetCheckedRows
      Dim L As String = e.Row("付款单位") 
        Select Case e.Row("付款单位") 
          Case "高科开发建设","高科置业发展","贵州望城投资"
            If r.Isnull("子公司负责人") = False Then
                If R("SFFK") = True Then          
                  MessageBox.show("此单已付过款了,不要重复付款!")
                  Else     
                     Dim nma() As String = { "SQDBH","JHBH","HTMC","XMBM","XMMC","KSBM","KSMC","JTCWB1","ZJLB","HTBH","JSGLDW","分项名称","标段" } \'A表数据来源列
                     Dim nmb() As String = { "SQDBH","JHBH","HTMC","XMBM","XMMC","KSJM","SKDW","YFKJE","ZJLB","HTBH","FKDW","分项名称","标段" } \'B表数据接收列
                     Dim dr As DataRow = DataTables("FKB").AddNew        
                   For i As Integer = 0 To nma.Length - 1
                 dr(nmb(i)) = r(nma(i))
             End If
         Case "高科控股集团"
            If r.Isnull("JTCWB3") = False Then
                If R("SFFK") = True Then          
                  MessageBox.show("此单已付过款了,不要重复付款!")
                  Else     
                     Dim nma() As String = { "SQDBH","JHBH","HTMC","XMBM","XMMC","KSBM","KSMC","JTCWB1","ZJLB","HTBH","JSGLDW","分项名称","标段" } \'A表数据来源列
                     Dim nmb() As String = { "SQDBH","JHBH","HTMC","XMBM","XMMC","KSJM","SKDW","YFKJE","ZJLB","HTBH","FKDW","分项名称","标段" } \'B表数据接收列
                     Dim dr As DataRow = DataTables("FKB").AddNew        
                   For i As Integer = 0 To nma.Length - 1
                 dr(nmb(i)) = r(nma(i))
               End If
             End Select
    Next
          Else
      MessageBox.show("资金申请表审批流程未完全通过,不能进行付款!")
   End If
Next    
  Else
      MessageBox.show("你没有付款处理的权限!")


--  作者:Bin
--  发布时间:2014/9/10 17:08:00
--  
提示什么错误,出现什么问题?
--  作者:有点甜
--  发布时间:2014/9/10 17:18:00
--  

 回复楼主,你这段代码写得......前后要对应

 

Select Case e.Row("付款单位")
    Case "高科开发建设","高科置业发展","贵州望城投资"
        If r.Isnull("子公司负责人") = False Then
            If R("SFFK") = True Then
                MessageBox.show("此单已付过款了,不要重复付款!")
            Else
                Dim nma() As String = { "SQDBH","JHBH","HTMC","XMBM","XMMC","KSBM","KSMC","JTCWB1","ZJLB","HTBH","JSGLDW","分项名称","标段" } \'A表数据来源列
                Dim nmb() As String = { "SQDBH","JHBH","HTMC","XMBM","XMMC","KSJM","SKDW","YFKJE","ZJLB","HTBH","FKDW","分项名称","标段" } \'B表数据接收列
                Dim dr As DataRow = DataTables("FKB").AddNew
                For i As Integer = 0 To nma.Length - 1
                    dr(nmb(i)) = r(nma(i))
                Next
            End If
        End If
    Case "高科控股集团"
        If r.Isnull("JTCWB3") = False Then
            If R("SFFK") = True Then
                MessageBox.show("此单已付过款了,不要重复付款!")
            Else
                Dim nma() As String = { "SQDBH","JHBH","HTMC","XMBM","XMMC","KSBM","KSMC","JTCWB1","ZJLB","HTBH","JSGLDW","分项名称","标段" } \'A表数据来源列
                Dim nmb() As String = { "SQDBH","JHBH","HTMC","XMBM","XMMC","KSJM","SKDW","YFKJE","ZJLB","HTBH","FKDW","分项名称","标段" } \'B表数据接收列
                Dim dr As DataRow = DataTables("FKB").AddNew
                For i As Integer = 0 To nma.Length - 1
                    dr(nmb(i)) = r(nma(i))
                Next
            End If
        End If
End Select

 

 


--  作者:爱相随
--  发布时间:2014/9/10 22:21:00
--  
提示编译错误:。。。
错误代码:Select Case e.Row("付款单位")
提示,这是写在菜单事件里的代码,应该是要指定数据表的行,但不知怎么指定。

--  作者:有点甜
--  发布时间:2014/9/10 22:23:00
--  

Select Case Tables("表A").Current("付款单位")

 

[此贴子已经被作者于2014-9-10 22:23:23编辑过]

--  作者:爱相随
--  发布时间:2014/9/11 15:22:00
--  
老师,我数据表中原来有列是老达式列,其表达式是IsNull([董事长2],0),现在情况有变,根据不同的条件取不同的列的值,比如,如果C列的值=D列的值,则数值=F列的值,否则,等于G列的值,是用表达式好还是通过代码计算好?如果是代码,谢老师帮忙,怎么写,写在哪里
--  作者:狐狸爸爸
--  发布时间:2014/9/11 15:29:00
--  

用表达式就行:

 

iif(c= d,f,g)


--  作者:爱相随
--  发布时间:2014/9/11 15:47:00
--  
老师,下面的代码,提示红色的有错,如果去掉红色的代码,则提示绿色的有错,是写在表事件DataColChange里的,怎么修改呢?
ElseIf e.DataCol.Name = "子公司1" Then
    Dim L As String = e.Row("付款单位") 
    Select Case e.Row("付款单位") 
      Case "高科开发建设","高科置业发展","贵州望城投资"
       Dim K As String = e.DataRow("子公司1")
         Select Case K
          Case "全额同意"
            e.DataRow("子公司2") = e.DataRow("财务2")
        Case "修改后同意"
            e.DataRow("子公司2") = Nothing
        Case Else
            e.DataRow("子公司2") = "0"
        End Select
     Case "高科控股集团"
        Dim K As String = e.DataRow("子公司1")
         Select Case K
          Case "全额同意"
            e.DataRow("子公司2") = e.DataRow("CBB")
        Case "修改后同意"
            e.DataRow("子公司2") = Nothing
        Case Else
            e.DataRow("子公司2") = "0"
        End Select
     End Select


--  作者:爱相随
--  发布时间:2014/9/11 15:48:00
--  
谢谢!!




--  作者:狐狸爸爸
--  发布时间:2014/9/11 15:54:00
--  
回8楼,你要贴出完整的代码,以及错误提示。