数据库

 首页 > 数据库 > MySql > 机房收费系统之—怎样查询两个日期之间的数据

机房收费系统之—怎样查询两个日期之间的数据

分享到:
【字体:
导读:
         摘要:日历控件刚刚学会怎么弄,但是要查询这两个语句之间的数据的语法我可是较劲脑汁啊,在网上查,自己试,可是每次不是语法错误就是连接不上数据库,我感觉这个方法就在我的眼前,我就是弄不出来,煞费苦心啊。下面是查询两个日历控件之间的代码,大家可以看看。Private Sub Command1_Click() date1 = ...

机房收费系统之—怎样查询两个日期之间的数据

       日历控件刚刚学会怎么弄,但是要查询这两个语句之间的数据的语法我可是较劲脑汁啊,在网上查,自己试,可是每次不是语法错误就是连接不上数据库,我感觉这个方法就在我的眼前,我就是弄不出来,煞费苦心啊。下面是查询两个日历控件之间的代码,大家可以看看。

Private Sub Command1_Click()
    date1 = DTPicker1.Value‘这是日历控件
    date2 = DTPicker2.Value
    '比较两个日期的大小
    If DateDiff("n", CDate(date1), CDate(date2)) < 0 Then
        MsgBox "起始日期与结束日期有冲突,请重新选择日期", , "提示"
        Exit Sub
    End If
    txtSQL = "select * from Recharge_Info where date >='" & date1 & "' and date <='" & date2 & "'"
    Set mrc = ExecuteSQL(txtSQL, Msgtext)
    If mrc.EOF = True Then
        MsgBox "没有信息"
        Exit Sub
    End If
    With MSFlexGrid1
   
        Do While mrc.EOF = False
            .CellAlignment = 4
            .Rows = .Rows + 1
            .TextMatrix(.Rows - 2, 0) = mrc!cardno
            .TextMatrix(.Rows - 2, 1) = mrc!addmoney
            .TextMatrix(.Rows - 2, 2) = mrc!Date
            .TextMatrix(.Rows - 2, 3) = mrc!Time
            .TextMatrix(.Rows - 2, 4) = mrc!userID
            .TextMatrix(.Rows - 2, 5) = mrc!Status
            mrc.MoveNext
            If mrc.EOF = True Then
                .Rows = .Rows - 1
            End If
        Loop
    End With
    mrc.Close
End sub

写了一大堆,其实最有用的是这句话
txtSQL = "select * from Recharge_Info where date >='" & date1 & "' and date <='" & date2 & "'"
此方法不仅可以比较日期,以此类推,基本上带数字的都能比较吧!

机房收费系统之—怎样查询两个日期之间的数据
分享到:
ORA-27102: out of memory报错的处理
ORA-27102: out of memory报错的处理问题描述: 原先SGA 4G,PGA 2G。 alter system set sga_max_size=30G scope=spfile; alter system set sga_target=30G scope=spfile; 之后, SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. 再次启动 SQL> startupORA-27102: out of memor...
oracle恢复已经删除的数据
oracle恢复已经删除的数据insert into tablerestore select * from tablerestore as of timestamp to_Date(&#039;2014-8-8 15:00:00&#039;,&#039;yyyy-mm-dd hh24:mi:ss&#039;)     参数解释:tablerestore 要恢复数据的表 后面的时间是恢复截止到某个点的数据   oracle恢复已经删除的数据
  •         php迷,一个php技术的分享社区,专属您自己的技术摘抄本、收藏夹。
  • 在这里……