用asp.net做网站发布新闻的时候怎样实现最近几天发布的新闻显示new?

解决方案 »

  1.   

    select * from news order by time desc
      

  2.   

    数据库查询时按新闻发布时间排序 BY ReleaseTime DESC;最新的就排在前面了。
      

  3.   

    就是想在网站发布新闻的时候,显示几天new图片
      

  4.   

    select nid,ntitle,ncontent from t_news order by credate desc
      

  5.   


    select top 10 nid,ntitle,ncontent from t_news order by credate desc
      

  6.   

    这个是逻辑问题,一般放在BLL层进行,当然,查询数据得到数据列表(table)后,就用for之类,查看时间,在三天之内,就设置为新的
      

  7.   

    在数据库里要有添加时间这列
    例如去最近两天的:
    获取当天的时间和前一天的时间sql:select * from t_news  where date  between 当前时间 and 前一天时间
      

  8.   

    select * from 表名 where time between sysdate-7 and sysdate
      

  9.   


    //这是用代码获取的最近一个星期的时间
    string strTime=DateTime.Now.AddDays(Convert.ToInt32(1 - Convert.ToInt32(DateTime.Now.DayOfWeek)) - 7).ToShortDateString();
      

  10.   

    --查最近一星期内的
    select * from 表名 where 时间字段 between DATEADD(d, -7, getdate()) and getdate()
      

  11.   


    //这是用代码获取的最近一个星期的时间
    string strTime=DateTime.Now.AddDays(Convert.ToInt32(1 - Convert.ToInt32(DateTime.Now.DayOfWeek)) - 7).ToShortDateString();
    string nowTime=DateTime.Now.ToShortDateString();select * from Test where Convert(datetime,testTime) between strTime and nowTime;
    //测试通过