以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  数据不自动改变  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=9476)

--  作者:caoxy
--  发布时间:2011/4/15 23:22:00
--  数据不自动改变

我在参数表中改娈材料单价,盘具成本表中的单价不自动改变,是不是代码有问题,请师傅帮助修正。

Select Case e.DataCol.Name
    Case "品种","型钢_规格"
        Dim dr2 As DataRow
        Dim fls As String
        fls = "盘具品种 = \'" & 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("排档_规格") & "\'"
        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("钢管_规格") & "\'"
        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("托圈_规格") & "\'"
        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("中板_规格") & "\'"
       
        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("元钢腰圈_规格") & "\'"
        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("加固角钢_规格") & "\'"
        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("护缆圈_规格") & "\'"
        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("拉丝圆_规格") & "\'"
        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("角钢腰圈_规格") & "\'"
        dr2 = DataTables("参数").Find(fls)
        If dr2 IsNot Nothing Then
            dr1("角钢腰圈_单价") = dr2("钢材单价")
        End If
End Select


--  作者:mr725
--  发布时间:2011/4/15 23:51:00
--  
你的代码放在哪里?
--  作者:狐狸爸爸
--  发布时间:2011/4/16 7:03:00
--  

提出这个问题,说明你还没有理解这段代码。这代代码设置在盘具成本表,目的是输入某个品种和规格后,从参数表取得单价并自动输入,代码的任务仅此而已。

如果要修改参数表,盘具成本表的单价也一起变动,请参考: 

http://help.foxtable.com/topics/1453.htm

[此贴子已经被作者于2011-4-16 7:56:34编辑过]

--  作者:caoxy
--  发布时间:2011/4/16 9:31:00
--  

我的代码放在:DataColChanged 里,根据狐狸师傅的提示,进行了重写测试,没有成功,可能是我写错,还是请师傅根据上面提供的代码帮助重写,谢谢师傅。

 


--  作者:czy
--  发布时间:2011/4/16 10:39:00
--  
贴出你重写的代码来看看。
--  作者:caoxy
--  发布时间:2011/4/16 11:01:00
--  
If e.DataCol.Name = "型钢_单价"
    Dim Filter As String ="[品种] = \'" & e.DataRow("盘具品种") & "\'And [型钢_规格] = \'" & e.DataRow("钢材规格") & "\'"
    Dim drs As List(Of DataRow) = DataTables("参数").Select(Filter)
    For Each dr As DataRow In drs
        dr("型钢_单价") = e.DataRow("钢材单价")
    Next
End If
盘具品种、钢材规格、钢材单价是参数表里的,要求是参数表里钢材单价改变,成本表里输入相对应村材料的单价也要改变
--  作者:czy
--  发布时间:2011/4/16 11:10:00
--  
If e.DataCol.Name = "钢材单价" Then
    Dim Filter As String ="[品种] = \'" & e.DataRow("盘具品种") & "\'And [型钢_规格] = \'" & e.DataRow("钢材规格") & "\'"
    Dim drs As List(Of DataRow) = DataTables("盘具成本").Select(Filter)
    For Each dr As DataRow In drs
        dr("型钢_单价") = e.DataRow("钢材单价")
    Next
End If

--  作者:caoxy
--  发布时间:2011/4/16 13:05:00
--  
为什么还是没有反映
--  作者:caoxy
--  发布时间:2011/4/16 15:01:00
--  

还是请师傅帮我分析呀

 

 


--  作者:blackzhu
--  发布时间:2011/4/16 15:10:00
--  
列有没有刷新过.