在C#.net中的SQL语句,语句如下
select * from p_gzsj a left join l_wsqd b on substring(CONVERT(varchar,a.rq, 120 ),1,10)=substring(CONVERT(varchar,b.qdrq, 120 ),1,10) and qdip=@yhip where substring(CONVERT(varchar,a.rq, 120 ),1,10) BetWeen substring(convert(varchar,'"+(System.DateTime.Now.AddDays(-7))+"',120),1,10) and substring(convert(varchar,'"+(System.DateTime.Now.AddDays(-3))+"',120),1,10) order by a.rq
如果当天为12-14日
System.DateTime.Now.AddDays(-7)的结果为2009-12-7怎么让结果为2009-12-07
求解~~~~~~~~
------解决方案--------------------------------------------------------
试一试
System.DateTime.Now.AddDays(-7).Format("yyyy-MM-dd");