Foxtable(狐表)用户栏目专家坐堂 → 加载当天的数据


  共有2546人关注过本帖树形打印复制链接

主题:加载当天的数据

帅哥哟,离线,有人找我吗?
恒隆君
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:496 积分:4055 威望:0 精华:0 注册:2017/7/5 16:15:00
加载当天的数据  发帖心情 Post By:2019/2/26 23:01:00 [只看该作者]

SQL server 数据库
为什么明明有入库日期 = 2019-2-26 的行。
但就是不加载。

如果filter 设为 "入库日期 <= '2019-2-26'
也是不能加载2019-2-26,必须要设成  "入库日期 <= '2019-2-27'

Dim dt As DataTable = DataTables("配件入库明细")
dt.LoadFilter = "入库日期 = '" & Date.today & "'"
msgbox(Date.today)
dt.Load()

 回到顶部
帅哥哟,离线,有人找我吗?
恒隆君
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:496 积分:4055 威望:0 精华:0 注册:2017/7/5 16:15:00
  发帖心情 Post By:2019/2/26 23:05:00 [只看该作者]

如查设一个全局代码 today.

怎样保持不重启系统

也是最新的日期。




 '读取SQL服务器时间

            Dim today As Date

            Dim cmd As New SQLCommand

            cmd.ConnectionName = cn

            cmd.CommandText = "Select GetDate()"

            Today = cmd.ExecuteScalar()



 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110574 积分:562760 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/2/26 23:21:00 [只看该作者]

日期值有时分秒,要这样用

dt.LoadFilter = "入库日期 >= '" & Date.today & "' and 入库日期 < '" & Date.today.adddays(1) & "'"

 回到顶部
帅哥哟,离线,有人找我吗?
恒隆君
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:496 积分:4055 威望:0 精华:0 注册:2017/7/5 16:15:00
  发帖心情 Post By:2019/2/27 0:36:00 [只看该作者]

不可以取日期里的 日期

加载当天的数据,
以前一直都没有这个问题。

关键是窗口里的筛选代码不知如何改。

Dim bjf() As String = {" ="," = "," like "," = "," = "," = ",">=","<=",">=","<="}
Dim fds() As String = {"仓库名称","入库原因","配件名称","配件代码","供应商名称","送货单号","入库日期","入库日期","数量","数量"}
Dim tpf() As String = {"","","%","","","","","","",""}
Dim filter As String
For i As Integer = 0 To nms.Length - 1
    If e.Form.Controls(nms(i)).text <> Nothing Then
        If filter > "" Then
            filter = filter & " And "
        End If
        filter = filter & fds(i) & bjf(i) & sps(i) & tpf(i) & e.Form.Controls(nms(i)).value &tpf(i) & sps(i)
' MessageBox.show(filter)
    End If
Next
DataTables("配件入库明细").LoadFilter = filter
DataTables("配件入库明细").Load()


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2019/2/27 9:29:00 [只看该作者]

Dim bjf() As String = {" ="," = "," like "," = "," = "," = ",">=","<=",">=","<="}
Dim fds() As String = {"仓库名称","入库原因","配件名称","配件代码","供应商名称","送货单号","入库日期","入库日期","数量","数量"}
Dim tpf() As String = {"","","%","","","","","","",""}
Dim filter As String
For i As Integer = 0 To nms.Length - 1
    If e.Form.Controls(nms(i)).text <> Nothing Then
        If filter > "" Then
            filter = filter & " And "
        End If
        If fds(i) = "入库日期" AndAlso bjf(i) = "<=" Then
            filter = filter & fds(i) & bjf(i) & sps(i) & tpf(i) & e.Form.Controls(nms(i)).value.adddays(1) &tpf(i) & sps(i)
        Else
            filter = filter & fds(i) & bjf(i) & sps(i) & tpf(i) & e.Form.Controls(nms(i)).value &tpf(i) & sps(i)
        End If

        MessageBox.show(filter)
    End If
Next
DataTables("配件入库明细").LoadFilter = filter
DataTables("配件入库明细").Load()

 


 回到顶部