public DateTime SyncWatchListInfo()
    {
        sql = "select max(OPTIME) from WATCHLIST";
        return DateTime.MinValue;   //从数据库中获得最后一次更新时间  
  }
我想将获得到的时间OPTIME直接返回,怎么做啊??多谢

解决方案 »

  1.   

    你可以返回一个 string 类型的值 然后调用的时候强制转换就可以了(Convert.ToDateTime() )
    或者你直接返回 DateTime , command执行的时候强制转换!
      

  2.   

    不好意思,写错了,我的意思是如何根据数据库中某张表的最后一个更新时间来获得数据??
    即select * from table where optime 是最后一个更新的,怎么做啊??
      

  3.   

    select top 1 * from table order by optime desc
      

  4.   

    如果分组,取每组里面optime最新的值就是
    select id,max(optime) from table group by id
      

  5.   

    return DateTime.parse(conn..ExecuteScalar(sql).tostring())
    是这个意思?要么这样 select * from table where optime = (select max(OPTIME) from WATCHLIST)
      

  6.   

    更新的时候将datetime.now存入数据库!