以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  求助-不重复列表  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=190975)

--  作者:lovetoday
--  发布时间:2024/3/18 10:17:00
--  求助-不重复列表
老师,我用以下代码,实现从表“白塔砼销明细”中,找到符合的行到“白塔泵送明细”中,其中有重复的日期和车号,但是相对应的作业工地名称有不同,
        Select Case r
            Case r("泵送明细_日期"), r("泵送明细_泵车信息_车号")
                Dim drs1 = DataTables("白塔泵送明细").SQLSelect(" 泵送明细_日期 = \'" & r("泵送明细_日期") & "\' and 泵送明细_泵车信息_车号 = \'" & r("泵送明细_泵车信息_车号") & "\'")
                Dim drs = DataTables("白塔砼销明细").SQLSelect(" 砼销明细_销售审核_日期0 = \'" & r("泵送明细_日期") & "\' and 砼销明细_泵车作业_泵号=\'" & r("泵送明细_泵车信息_车号") & "\'")
                For Each cdr As DataRow In drs
                    Dim flag As Boolean = True
                    For Each dr As DataRow In drs1
                        If cdr("砼销明细_泵送名称0") = dr("泵送明细_作业工地名称") Then
                            flag = False
                            Exit For
                        End If
                    Next
                    If flag Then
                        r("泵送明细_作业工地名称") = cdr("砼销明细_泵送名称0")
                        r("泵送明细_销售客户名称") = cdr("砼销明细_销售名称0")
                    End If
                Next
        End Select
运行后,系统提示如下

图片点击可在新窗口打开查看此主题相关图片如下:6.png
图片点击可在新窗口打开查看
请老师帮忙看看,问题出在哪


--  作者:有点蓝
--  发布时间:2024/3/18 10:27:00
--  
贴出完整代码
--  作者:lovetoday
--  发布时间:2024/3/18 16:08:00
--  
\'作业工地名称及销售工地名称
For Each r As Row In Tables("工作总表_Table4").Rows
    If r("泵送明细_日期") = Nothing Then
        r("泵送明细_作业工地名称") = Nothing
        r("泵送明细_销售客户名称") = Nothing
    Else
 \'       Select Case r
 \'           Case r("泵送明细_日期"), r("泵送明细_泵车信息_车号")
                Dim drs1 = DataTables("白塔泵送明细").SQLSelect(" 泵送明细_日期 = \'" & r("泵送明细_日期") & "\' and 泵送明细_泵车信息_车号 = \'" & r("泵送明细_泵车信息_车号") & "\'")
                Dim drs = DataTables("白塔砼销明细").SQLSelect(" 砼销明细_销售审核_日期0 = \'" & r("泵送明细_日期") & "\' and 砼销明细_泵车作业_泵号=\'" & r("泵送明细_泵车信息_车号") & "\'")
                For Each cdr As DataRow In drs
                    Dim flag As Boolean = True
                    For Each dr As DataRow In drs1
                        If cdr("砼销明细_泵送名称0") = dr("泵送明细_作业工地名称") Then
                            flag = False
                            Exit For
                        End If
                    Next
                    If flag Then
                        r("泵送明细_作业工地名称") = cdr("砼销明细_泵送名称0")
                        r("泵送明细_销售客户名称") = cdr("砼销明细_销售名称0")
                    End If
                Next
 \'       End Select
    End If 
Next 

--  作者:有点蓝
--  发布时间:2024/3/18 16:12:00
--  
看的有点迷糊,这个代码想实现什么功能?