以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  列出科目详细名称  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=158740)

--  作者:zhuxinhui
--  发布时间:2020/12/1 11:32:00
--  列出科目详细名称
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目1.rar

想列出当前行科目详细明称,好像名称列哪样自动生成。
图片点击可在新窗口打开查看此主题相关图片如下:qq截图20201201112703.png
图片点击可在新窗口打开查看
Dim dr1 As DataRow = e.DataRow
Dim str1 As String
Dim st As String
Select Case e.DataCol.Name
    Case  e.DataRow("科目编码").length >= 4
        Dim strr As String = e.DataRow("科目编码").substring(0,4)
        Dim fdr As DataRow = DataTables("科目表").find("科目编码=\'" & strr & "\'")
        st = fdr("科目名称")
        \' MessageBox.Show("4")
        
    Case e.DataRow("科目编码").length >= 8
        Dim  strr As String = e.DataRow("科目编码").substring(0,8)
        Dim fdr As DataRow = DataTables("科目表").find("科目编码=\'" & strr & "\'")
        \'Dim fdr As DataRow = DataTables("科目表").find("& strr &=\'" & dr1("科目编码") & "\'")
        st = fdr("科目名称")
        str1 &=  "-"& st
        
    Case e.DataRow("科目编码").length >= 12
        Dim  strr As String = e.DataRow("科目编码").substring(0,12)
        Dim fdr As DataRow = DataTables("科目表").find("科目编码=\'" & strr & "\'")
        \'Dim fdr As DataRow = DataTables("科目表").find("& strr &=\'" & dr1("科目编码") & "\'")
        st = fdr("科目名称")
        str1 &=  "-"& st
        
    Case e.DataRow("科目编码").length >= 16
        Dim  strr  As String = e.DataRow("科目编码").substring(0,16)
        Dim fdr As DataRow = DataTables("科目表").find("科目编码=\'" & strr & "\'")
        \'Dim fdr As DataRow = DataTables("科目表").find("& strr &=\'" & dr1("科目编码") & "\'")
        st = fdr("科目名称")
        str1 &=  "-"& st
        
    Case e.DataRow("科目编码").length >= 18
        Dim  strr  As String= e.DataRow("科目编码").substring(0,18)
        Dim fdr As DataRow = DataTables("科目表").find("科目编码=\'" & strr & "\'")
        \'Dim fdr As DataRow = DataTables("科目表").find("& strr &=\'" & dr1("科目编码") & "\'")
        st = fdr("科目名称")
        str1 &=  "-"& st
        
    Case Else
        e.DataRow("科目详细名称")= str1
End Select
老是提示字符串转换出问题

--  作者:有点蓝
--  发布时间:2020/12/1 11:41:00
--  
Dim dr1 As DataRow = e.DataRow
Dim str1 As String
Dim st As String
Select Case e.DataCol.Name
case "科目编码","科目名称"
    if  e.DataRow("科目编码").length >= 4
        Dim strr As String = e.DataRow("科目编码").substring(0,4)
        Dim fdr As DataRow = DataTables("科目表").find("科目编码=\'" & strr & "\'")
if fdr isnot nothing then
        st = fdr("科目名称")
end if
        \' MessageBox.Show("4")
elseif e.DataRow("科目编码").length >= 8
        Dim  strr As String = e.DataRow("科目编码").substring(0,8)
        Dim fdr As DataRow = DataTables("科目表").find("科目编码=\'" & strr & "\'")
if fdr isnot nothing then
        st = fdr("科目名称")
        str1 &=  "-"& st
end if
else.............

--  作者:有点蓝
--  发布时间:2020/12/1 12:08:00
--  
Select Case e.DataCol.Name
    Case "科目编码","科目名称"
        If e.DataRow.IsNull("科目编码") = False
            
            Dim st As String = e.DataRow("科目编码")
            Dim str1 As String = e.DataRow("科目名称")
            Do While st.Length > 4
                st = st.substring(0,st.Length - 4)
                Dim fdr As DataRow = e.DataTable.find("科目编码=\'" & st & "\'")
                If fdr IsNot Nothing Then
                    str1 = fdr("科目名称") & "-" & str1
                End If
            Loop
            e.DataRow("科目详细名称")= str1
        End If
End Select