取前三天的资料,如2007-08-13 00:00:00 到 2007-08-16 23:59:29 ?
if(!this.IsPostBack)
{
if(DateTime.Now.DayOfWeek==System.DayOfWeek.Monday)
{
this.tb_time.Text=DateTime.Now.AddDays(-2).ToString( "yyyy-MM-dd ");
}
else
{
this.tb_time.Text=DateTime.Now.AddDays(-1).ToString( "yyyy-MM-dd ");
}
}
请教如果取2007-08-13 00:00:00 到 2007-08-16 23:59:29的资料怎么修改.谢!
where PlanStartTime> ' "+this.tb_time.Text.Substring(0,10)+ " 00:00:00 "+ " ' and PlanStartTime < ' "+this.tb_time.Text.Substring(0,10)+ " 23:59:59 "+ " ' order by dbo.nb_JiaBanLog.FormNumber ");
[解决办法]
你都写出来了
[解决办法]
Datediff(d,convert(varchar,PlanStartTime,120),GETDATE()) <=3
[解决办法]
if(!this.IsPostBack)
{
if(DateTime.Now.DayOfWeek==System.DayOfWeek.Monday)
{
this.tb_time.Text=DateTime.Now.AddDays(-2).ToString( "yyyy-MM-dd ");
}
else
{
this.tb_time.Text=DateTime.Now.AddDays(-1).ToString( "yyyy-MM-dd ");
}
}
-------------------------
上面一段可以不要的.GETDATE() 这个可以获取当前数据库服务器的时间
[解决办法]
用SQL语句处理比较好
[解决办法]
不需用任何的按钮.
=========
绑定代码放到 Page_Load 里面
[解决办法]
select * from 表 where Datediff(d,convert(varchar(10),PlanStartTime,120),GETDATE()) <=3
order by dbo.nb_JiaBanLog.FormNumber