Rss & SiteMap

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

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

标题:Sortkey 问题

1楼
edisontsui 发表于:2023/8/3 15:44:00

图片点击可在新窗口打开查看此主题相关图片如下:图片8.jpg
图片点击可在新窗口打开查看


下面 datacolchanged 里面的代码,老是会出现上面图中的提示,请问是什么原因?谢谢
If e.DataCol.Name = "生产日期" Then 
    Dim d3 As String = Format(e.DataRow("生产日期"), "yyyyMMdd")
    msgbox(d3)
    e.DataRow.BaseRow("_SortKey") = d3.Substring(0, 8) 
End If

2楼
有点蓝 发表于:2023/8/3 15:49:00
去掉msgbox
3楼
edisontsui 发表于:2023/8/3 16:55:00
气死我了,这个地方都没有看到问题。谢谢。
4楼
edisontsui 发表于:2023/8/3 17:21:00
If e.DataCol.Name = "冲头更换日期" Then
    If e.NewValue IsNot Nothing Then
    Else
        MsgBox(1)
        For Each dr3 As DataRow In DataTables("生产模数记录").Select("模具型号 = '" & e.DataRow("模具型号") & "' and 冲头更换日期 > '" & e.oldvalue & "'") 
            MsgBox(2)
            dr3("上次更换冲头模数") = Nothing
        Next
    End If
End If

上面的代码,MsgBox(1) 会有提示,MsgBox(2) 就没有提示了,请问是什么问题?是不是因为 newvalue 是空值,就无法执行代码?谢谢。
5楼
有点蓝 发表于:2023/8/3 17:23:00
没有符合条件的数据:

..........Select("模具型号 = '" & e.DataRow("模具型号") & "' and 冲头更换日期 > '" & e.oldvalue & "'"
6楼
edisontsui 发表于:2023/12/16 8:41:00
Dim drs As List(Of DataRow) = DataTables("出入库2").SQLSelect("[物料编号] = '" & e.DataRow("物料编号") & "'", "[_SortKey]")
Dim drs As List(Of DataRow) = DataTables("出入库2").SQLSelect("[物料编号] = '" & e.DataRow("物料编号") & "'")
msgbox("cnt=" & drs.Count)
上面两个SQLSelect语句,我用第一句时,计算出的行数cnt是0,这是错误的;而用第二句时,计算出的行数cnt就是正确的。请问是什么原因呢?谢谢
7楼
有点蓝 发表于:2023/12/16 9:31:00
因为不看帮助,不按语法使用:http://www.foxtable.com/webhelp/topics/2900.htm,看示例四

select函数的第二个参数是Top【Top:    可选参数,指定返回的行数】,结果上面写的是【"[_SortKey]"】,数据库理解不了,就无法返回数据,改为

Dim drs As List(Of DataRow) = DataTables("出入库2").SQLSelect("[物料编号] = '" & e.DataRow("物料编号") & "'","", "[_SortKey]")
8楼
edisontsui 发表于:2023/12/16 11:02:00
果然是这样。谢谢。
    Dim drs As List(Of DataRow) = DataTables("出入库").SQLSelect("[物料编号] = '" & e.DataRow("物料编号") & "'", "", "[_SortKey]")    
    For i As Integer = 0 To drs.Count - 1
        If i = 0 Then
            drs(i)("余数") = drs(i)("出入库数量")
        Else 
            drs(i)("余数") = drs(i - 1)("余数") + drs(i)("出入库数量")
        End If
        If i > 0 Then 
            If drs(i)("出入年月") = drs(i - 1)("出入年月") Then
                drs(i)("上行余数") = Nothing
            Else
                drs(i)("上行余数") = drs(i - 1)("余数")
            End If
        End If
    Next
    DataTables("出入库").SQLUpdate(drs)  

上面那段代码,如果改成 DataTables("订单").SQLReplaceFor("折扣", 0.05, "产品 = 'PD01'") 的模式,是不是效率会更高?但是,我不知道怎么改。谢谢。
9楼
有点蓝 发表于:2023/12/16 11:17:00
改不了。只能上面这样用
10楼
edisontsui 发表于:2023/12/16 12:30:00
好的。
共10 条记录, 每页显示 10 条, 页签: [1]

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

Powered By Dvbbs Version 8.3.0
Processed in .03125 s, 2 queries.