能不能用SQL查询时,加一个时间条件,比如:
"select * from xx where "& DateTime.Now &" - activetime> xx时间"
就是“现在的时间”-“activetime里的时间”>“指定的时间”问一下……还有,用一下这类方法        Dim Conn As New OleDb.OleDbConnection
        Dim Comm As New OleDb.OleDbCommand
        Dim Reader As OleDb.OleDbDataReader
        Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & HttpContext.Current.Server.MapPath("data.mdb") & ";user id=;password=;persist security info=true;"
        Conn.Open()
        Comm.Connection = Conn
        Comm.CommandText = "select * from members where id=" & uid
        Reader = Comm.ExecuteReader怎么知道Reader有多少条记录……

解决方案 »

  1.   

    你跟踪一下SQL语句,然后在数据库中看看到底几条数据
      

  2.   

    有没有Reader的属性来获得记录条数?
      

  3.   

    Select [CreateTime] from TabName WHERE ([CreateTime] < GETDATE()-10)
    这里说的是,查寻表建立时间小于当前时间减去10天的数据
      

  4.   

    sql里面日期相差多久使用datediff函数,可以计算两个日期差多少年或多少月或日...
    DataReader不能直接得到记录数,因为它是逐行访问的,你可以用一个计数器,每访问一行加一,最后才得到行数
      

  5.   

    datediff具体怎么用?
    能详细说明一下或几个例子吗?谢谢……
      

  6.   

    select *from [table] where datediff(day,getdate(),yourdate)>1
    只是示例一下,去搜下datediff的参数就了解了
      

  7.   

    SELECT DATEDIFF(year, '2005-12-20', '2006-01-01')相差多少年
    SELECT DATEDIFF(month, '2005-12-20', '2006-01-01')相差多少月
    SELECT DATEDIFF(day, '2005-12-20', '2006-01-01')相差多少日select * from xx where datediff(day, activetime ,getdate()) > 10   取出与当前日期相差超过10天的