If Text1.Text <> "" Then
        qbsj = "and (ghzq- DateDiff("d",ghsj, dqsj))>='" & Text1.Text & "'"
    Else
        qbsj = ""
    End If
我要把qbsj加在sql查询语句的后面,其中dqsj是系统当前时间,ghsj是数据库表字段名,也是一个时间,text1.text是一个数字
总体意思是把数据库中的时间与当前时间相差大于text1.text天的记录查询出来
    这个语句怎么写

解决方案 »

  1.   

    select * from 他查询条件 and DATEDIFF("dd", 日期栏位, getdate())>='" & Text1.Text & "'"
      

  2.   

    太粗心了:select * from 表格 where 他查询条件 and DATEDIFF("dd", 日期栏位, getdate())>='" & Text1.Text & "'"
      

  3.   

    rs.Open _
            "select * from tb_sb_gl where id>0 and (ghzq-DateDiff('" & d & "',ghsj, getdate())>='" & Text1.Text & "'"
    这是我的语句,提示 为datediff指定了无效参数1
      

  4.   

    ghzq也是一个字段名 ,是一个数字
      

  5.   

    select * from yourtable where yourquery and datediff(d,dqsj,getdate())>" & text1.text
      

  6.   

    select * from tb_sb_gl where id>0 and (ghzq-DateDiff("d",ghsj, getdate())>=" & Text1.Text 
    试试
      

  7.   

    rs.Open _
            "select * from tb_sb_gl where id>0 and (ghzq-DateDiff('" & d & "',ghsj, getdate())>='" & Text1.Text & "'"
    如果在这上面改,怎么改
      

  8.   

    提示 为datediff指定了无效参数1