Foxtable(狐表)用户栏目专家坐堂 → [求助]设置多个日期列中有今天日期条件


  共有1495人关注过本帖平板打印复制链接

主题:[求助]设置多个日期列中有今天日期条件

帅哥哟,离线,有人找我吗?
沪上游客
  1楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:266 积分:2144 威望:0 精华:0 注册:2012/3/28 16:49:00
[求助]设置多个日期列中有今天日期条件  发帖心情 Post By:2023/9/19 15:44:00 [只看该作者]

Dim t As DataTable = DataTables("核算项目科目组合表")
For Each dr As DataRow In t.DataRows 
    Dim Val1 As Date = dr("应收账款更新日期")
    Dim Val2 As Date = dr("应交税费更新日期")
    Dim Val3 As Date = dr("内部往来更新日期")
    Dim Val4 As Date = dr("工程施工更新日期")
    Dim Val5 As Date = dr("损益更新日期")
    Dim Val6 As Date = dr("应付账款更新日期")
    Dim cmd As New SQLCommand
    Dim dts As Date
    cmd.C
    cmd.CommandText = "Select GetDate()"
    dts = cmd.ExecuteScalar()
    If dts In (Val1, Val2, Val3, Val4, Val5, Val6) Then
        dr("更新记录_更新日期") = dts
        dr("变动状态") = "变动"
    Else
        dr("变动状态") = Nothing 
    End If 
Next 
老师上面代码是在一行中我多个日期列,如果其中至少有一列日期是今天,那么执行,否则变动状态列为空值。出错了,应该怎么写?
谢谢老师!
图片点击可在新窗口打开查看
[此贴子已经被作者于2023/9/19 15:47:10编辑过]

 回到顶部