以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  多列自动显示  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=9323)

--  作者:caoxy
--  发布时间:2011/3/29 19:56:00
--  多列自动显示

师傅你好:我写的代码请师傅帮助整理

Dim dr1 As DataRow = e.DataRow
Select Case e.DataCol.Name
    Case "全木盘_材料","规格","全木盘_厚度", "地点"
        Dim dr2 As DataRow
        Dim fls As String
        fls = "名称 = \'" & dr1("全木盘_材料") & "\' And 规格 = \'" & dr1("规格") & "\' And 厚度 = " & dr1("全木盘_厚度") & " And 送货地点  = \'" & dr1("地点") & "\'"
        dr2 = DataTables("参数").Find(fls)
        If dr2 IsNot Nothing Then
            dr1("全木盘_单价") = dr2("单价")
        End If
End Select
Select Case e.DataCol.Name
    Case "芯板_材料","芯板_长度","芯板_厚度", "地点"
        Dim dr2 As DataRow
        Dim fls As String
        fls = "名称 = \'" & dr1("芯板_材料") & "\' And 规格 = \'" & dr1("芯板_长度") & "\' And 厚度 = " & dr1("芯板_厚度") & " And 送货地点  = \'" & dr1("地点") & "\'"
        dr2 = DataTables("参数").Find(fls)
        If dr2 IsNot Nothing Then
            dr1("芯板_单价") = dr2("单价")
        End If
End Select
Select Case e.DataCol.Name
    Case "封板_材料","封板_长度","封板_厚度", "地点"
        Dim dr2 As DataRow
        Dim fls As String
        fls = "名称 = \'" & dr1("封板_材料") & "\' And 规格 = \'" & dr1("封板_长度") & "\' And 厚度 = " & dr1("封板_厚度") & " And 送货地点  = \'" & dr1("地点") & "\'"
        dr2 = DataTables("参数").Find(fls)
        If dr2 IsNot Nothing Then
            dr1("封板_单价") = dr2("单价")
        End If
End Select
Select Case e.DataCol.Name
    Case "扇形板_材料","扇形板_长度","扇形板_厚度", "地点"
        Dim dr2 As DataRow
        Dim fls As String
        fls = "名称 = \'" & dr1("扇形板_材料") & "\' And 规格 = \'" & dr1("扇形板_长度") & "\' And 厚度 = " & dr1("扇形板_厚度") & " And 送货地点  = \'" & dr1("地点") & "\'"
        dr2 = DataTables("参数").Find(fls)
        If dr2 IsNot Nothing Then
            dr1("扇形板_单价") = dr2("单价")
        End If
End Select

1、上面的代码只第一组能显示,其它的不显示。

2、上面的代码能不能筒化,只达到目的就行。

 


--  作者:狐狸爸爸
--  发布时间:2011/3/29 22:33:00
--  

第二段和第三段的Case语句是相同的,可以合并吧?

为啥不显示,这个猜不出来的,得有点数据测试才行。


--  作者:caoxy
--  发布时间:2011/3/30 7:45:00
--  

上面的代码这样写是下正确的码