Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共13 条记录, 每页显示 10 条, 页签: [1] [2]
[浏览完整版]

标题:引用出错

1楼
7032175 发表于:2011/10/29 15:40:00

这个表在引用的时候在实测值里面输入内容后就会出现如图所示的问题 不知道 是怎么回事  代码我研究了半天 也没有错在什么地方 实在是搞不定了 还是请狐狸爸爸帮我一下麻烦狐狸爸爸了

 下载信息  [文件大小:1.4 MB  下载次数:13]
图片点击可在新窗口打开查看点击浏览该文件:生产管理系统.table


图片点击可在新窗口打开查看此主题相关图片如下:qq截图20111029153812.png
图片点击可在新窗口打开查看
2楼
7032175 发表于:2011/10/29 15:41:00
密码是888
3楼
狐狸爸爸 发表于:2011/10/29 15:42:00

错误提示非常清楚,“理化厂标"没有“原”这一列。

再看看:

 

http://www.foxtable.com/help/topics/1485.htm

 

4楼
7032175 发表于:2011/10/29 15:58:00

我看到这个了  我研究了半天还是没有搞定  这段代码 是狐爸爸您写的 我只做了一点点的修改 现在就是不能用 真是急死我了

5楼
7032175 发表于:2011/10/29 16:04:00
狐狸爸爸由于我的水平有限 还是请狐狸爸爸 写一下  谢谢您了
6楼
7032175 发表于:2011/10/29 16:12:00

我搞明白问题出在什么地方了  但是就是不知道 怎么改 由于我的实测有很多多表头而且分布不一样  (nm & "_" & "厂标" ) = "合格"    前面nm & "_" & "厂标" 只针对一个分列 但是我的表里面有二个甚至二个以上的分列表头 这段代码就不能管用了

 

 

请问题狐狸爸爸  这样如何更改代码

7楼
狐狸爸爸 发表于:2011/10/29 19:52:00

Select Case e.DataCol.name
    Case "牌号"
        Dim dr As DataRow = DataTables("理化厂标").Find("牌号 = '" & e.NewVAlue & "'")
        If dr IsNot Nothing Then
            e.DataRow("原料指标_MgO镁_厂标")  = dr("原料指标_MgO镁")
            e.DataRow("原料指标_SiO2硅_厂标")  = dr("原料指标_SiO2硅")
           ' e.DataRow("硅_厂标")  = dr("硅")
           ' e.DataRow("钙_厂标")  = dr("钙")
        Else
            e.DataRow("原料指标_MgO镁_厂标")  = Nothing
            e.DataRow("原料指标_SiO2硅_厂标")  = Nothing
           ' e.DataRow("硅_厂标")  = Nothing
           ' e.DataRow("钙_厂标")  = Nothing
        End If
    Case "原料指标_MgO镁_实测","原料指标_SiO2硅_实测"
        Dim dr As DataRow = DataTables("理化厂标").Find("牌号 = '" & e.DataRow("牌号") & "'")
        If dr IsNot Nothing AndAlso e.newvalue Then
            Dim nm As String = e.DataCol.Name
            nm = nm.SubString(0,nm.LastIndexOf("_"))
            Dim ov As String = dr(nm)
            If ov.IndexOf("-") > 0 Then
                Dim vls() As String = ov.split("-")
                Dim v1 As Double = vls(0)
                Dim v2 As Double = vls(1)
                If e.newvalue >= v1 AndAlso e.newvalue <= v2 Then
                    e.DataRow(nm & "_" & "厂标" ) = "合格"
                ElseIf e.newvalue < v1 Then
                    e.DataRow(nm & "_" & "厂标" ) = e.newvalue - v1
                Else
                    e.DataRow(nm & "_" & "厂标" ) = e.newvalue - v2
                End If
            Else
                Dim o As String = ov.SubString(0,1)
                Dim v As Double = val(ov.SubString(1))
                If o = ">" Then
                    If e.NewValue > v Then
                        e.DataRow(nm & "_" & "厂标" ) = "合格"
                    Else
                        e.DataRow(nm & "_" & "厂标" ) = v - e.newvalue
                    End If
                ElseIf o = "<"
                    If e.NewValue < v Then
                        e.DataRow(nm & "_" & "厂标" ) = "合格"
                    Else
                        e.DataRow(nm & "_" & "厂标" ) =  e.newvalue - v
                    End If
                ElseIf o = "≥" Then
                    If e.NewValue >= v Then
                        e.DataRow(nm & "_" & "厂标" ) = "合格"
                    Else
                        e.DataRow(nm & "_" & "厂标" ) = v - e.newvalue
                    End If
                ElseIf o = "≤"
                    If e.NewValue <= v Then
                        e.DataRow(nm & "_" & "厂标" ) = "合格"
                    Else
                        e.DataRow(nm & "_" & "厂标" ) =  e.newvalue - v
                    End If
                End If
            End If
        End If
End Select

[此贴子已经被作者于2011-10-29 19:51:49编辑过]
8楼
7032175 发表于:2011/11/10 16:26:00

Select Case e.DataCol.name
Case "牌号"
Dim dr As DataRow = DataTables("理化厂标").Find("牌号 = '" & e.NewVAlue & "'")
If dr IsNot Nothing Then
e.DataRow("原料指标_MgO镁_厂标") = dr("原料指标_MgO镁")
e.DataRow("原料指标_SiO2硅_厂标") = dr("原料指标_SiO2硅")
' e.DataRow("硅_厂标") = dr("硅")
' e.DataRow("钙_厂标") = dr("钙")
Else
e.DataRow("原料指标_MgO镁_厂标") = Nothing
e.DataRow("原料指标_SiO2硅_厂标") = Nothing
' e.DataRow("硅_厂标") = Nothing
' e.DataRow("钙_厂标") = Nothing
End If
Case "原料指标_MgO镁_实测","原料指标_SiO2硅_实测"
Dim dr As DataRow = DataTables("理化厂标").Find("牌号 = '" & e.DataRow("牌号") & "'")
If dr IsNot Nothing AndAlso e.newvalue Then
Dim nm As String = e.DataCol.Name
nm = nm.SubString(0,nm.LastIndexOf("_"))
Dim ov As String = dr(nm)
If ov.IndexOf("-") > 0 Then
Dim vls() As String = ov.split("-")
Dim v1 As Double = vls(0)
Dim v2 As Double = vls(1)
If e.newvalue >= v1 AndAlso e.newvalue <= v2 Then
e.DataRow(nm & "_" & "厂标" ) = "合格"
ElseIf e.newvalue < v1 Then
e.DataRow(nm & "_" & "厂标" ) = e.newvalue - v1
Else
e.DataRow(nm & "_" & "厂标" ) = e.newvalue - v2
End If
Else
Dim o As String = ov.SubString(0,1)
Dim v As Double = val(ov.SubString(1))
If o = ">" Then
If e.NewValue > v Then
e.DataRow(nm & "_" & "厂标" ) = "合格"
Else
e.DataRow(nm & "_" & "厂标" ) = v - e.newvalue
End If
ElseIf o = "<"
If e.NewValue < v Then
e.DataRow(nm & "_" & "厂标" ) = "合格"
Else
e.DataRow(nm & "_" & "厂标" ) = e.newvalue - v
End If
ElseIf o = "≥" Then
If e.NewValue >= v Then
e.DataRow(nm & "_" & "厂标" ) = "合格"
Else
e.DataRow(nm & "_" & "厂标" ) = v - e.newvalue
End If
ElseIf o = "≤"
If e.NewValue <= v Then
e.DataRow(nm & "_" & "厂标" ) = "合格"
Else
e.DataRow(nm & "_" & "厂标" ) = e.newvalue - v
End If
End If
End If
End If
End Select

狐狸爸爸 这个代码会针对这样几种情况时行判断  首先是  N值--N值、〈N值、〉N值、≥N值、≤N值   这是现在的对N值的判断。

还有一种判断就是只针对N值   厂标里面只有数字,没有大于、小于等等的符号,当实测里面的数大于或小于厂标里面的数时用正负数体现,代码如何加进去

9楼
狐狸爸爸 发表于:2011/11/10 16:39:00
Select Case e.DataCol.name
    Case "牌号"
        Dim dr As DataRow = DataTables("理化厂标").Find("牌号 = '" & e.NewVAlue & "'")
        If dr IsNot Nothing Then
            e.DataRow("原料指标_MgO镁_厂标")  = dr("原料指标_MgO镁")
            e.DataRow("原料指标_SiO2硅_厂标")  = dr("原料指标_SiO2硅")
            ' e.DataRow("硅_厂标")  = dr("硅")
            ' e.DataRow("钙_厂标")  = dr("钙")
        Else
            e.DataRow("原料指标_MgO镁_厂标")  = Nothing
            e.DataRow("原料指标_SiO2硅_厂标")  = Nothing
            ' e.DataRow("硅_厂标")  = Nothing
            ' e.DataRow("钙_厂标")  = Nothing
        End If
    Case "原料指标_MgO镁_实测","原料指标_SiO2硅_实测"
        Dim dr As DataRow = DataTables("理化厂标").Find("牌号 = '" & e.DataRow("牌号") & "'")
        If dr IsNot Nothing AndAlso e.newvalue Then
            Dim nm As String = e.DataCol.Name.SubString(0,1)
            Dim ov As String = dr(nm)
            If Isnumeric(ov) Then
                Dim v As Double = ov
                If e.NewValue = v Then
                    e.DataRow(nm & "_" & "厂标" ) = "合格"
                ElseIf  e.NewValue > v Then
                    e.DataRow(nm & "_" & "厂标" ) = e.newvalue -v
                Else
                    e.DataRow(nm & "_" & "厂标" ) = v - e.newvalue
                End If
            ElseIf  ov.IndexOf("-") > 0 Then
                Dim vls() As String = ov.split("-")
                Dim v1 As Double = vls(0)
                Dim v2 As Double = vls(1)
                If e.newvalue >= v1 AndAlso e.newvalue <= v2 Then
                    e.DataRow(nm & "_" & "厂标" ) = "合格"
                ElseIf e.newvalue < v1 Then
                    e.DataRow(nm & "_" & "厂标" ) = e.newvalue - v1
                Else
                    e.DataRow(nm & "_" & "厂标" ) = e.newvalue - v2
                End If
            Else
                Dim o As String = ov.SubString(0,1)
                Dim v As Double = val(ov.SubString(1))
                If o = ">" Then
                    If e.NewValue > v Then
                        e.DataRow(nm & "_" & "厂标" ) = "合格"
                    Else
                        e.DataRow(nm & "_" & "厂标" ) = v - e.newvalue
                    End If
                ElseIf o = "<"
                    If e.NewValue < v Then
                        e.DataRow(nm & "_" & "厂标" ) = "合格"
                    Else
                        e.DataRow(nm & "_" & "厂标" ) =  e.newvalue - v
                    End If
                ElseIf o = "≥" Then
                    If e.NewValue >= v Then
                        e.DataRow(nm & "_" & "厂标" ) = "合格"
                    Else
                        e.DataRow(nm & "_" & "厂标" ) = v - e.newvalue
                    End If
                ElseIf o = "≤"
                    If e.NewValue <= v Then
                        e.DataRow(nm & "_" & "厂标" ) = "合格"
                    Else
                        e.DataRow(nm & "_" & "厂标" ) =  e.newvalue - v
                    End If
                End If
            End If
        End If
End Select
10楼
7032175 发表于:2011/11/11 8:50:00

狐狸爸爸你写的这段代码应用起来有错误 呀 

共13 条记录, 每页显示 10 条, 页签: [1] [2]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .14844 s, 3 queries.