以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  如何才能修改合并取值呢?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=91652)

--  作者:zhuxin
--  发布时间:2016/10/15 17:07:00
--  如何才能修改合并取值呢?

dr("日期货物名称规格")  = dr("日期") & dr("货物名称") & dr("规格") 不知怎样修改才能将日期只是取月日四位数、货物名称只是取其前面的6个字符,不足6个只取现有的,规格型号只取其中前5个字符。

Select Case e.DataCol.Name
    Case "日期","货物名称"
        Dim dr As DataRow = e.DataRow
        If dr.IsNull("日期") And dr.IsNull("货物名称") Then
            dr("日期货物名称规格") = Nothing
        Else
            dr("日期货物名称规格")  = dr("日期") & dr("货物名称") & dr("规格")
        End If
End Select

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目1.table


--  作者:有点蓝
--  发布时间:2016/10/15 17:39:00
--  
Select Case e.DataCol.Name
    Case "日期","货物名称"
        Dim dr As DataRow = e.DataRow
        If dr.IsNull("日期") And dr.IsNull("货物名称") Then
            dr("日期货物名称规格") = Nothing
        Else
            Dim n As String
            If dr.IsNull("货物名称") = False Then
                If dr("货物名称").length > 6 Then
                    n = dr("货物名称").SubString(0,6)
                Else
                    n =dr("货物名称")
                End If
            End If
            Dim g As String
            If dr.IsNull("规格") = False Then
                If dr("规格").length > 5 Then
                    g = dr("规格").SubString(0,5)
                Else
                    g = dr("规格")
                End If
            End If
            dr("日期货物名称规格")  = Format(dr("日期"),"yyMM") & n & g
        End If
End Select

--  作者:zhuxin
--  发布时间:2016/10/15 20:47:00
--  

多谢,测试通过