我想查询数据库中当天的数据。就显示当天的。我数据库中的日期格式是**月**日,
我是用取得当天的月再取日。下面最后两句有点问题。。高手指点下。。
或者有什么好的方法。。
this.Label2.Text=System.DateTime.Now.Month.ToString();
this.Label1.Text=System.DateTime.Now.Day.ToString();
SqlDataAdapter cmd=new SqlDataAdapter ("select * from me where HDate=this.Label2.Text+"'月"+this.Label1.Text+"日"'",con);
我是用取得当天的月再取日。下面最后两句有点问题。。高手指点下。。
或者有什么好的方法。。
this.Label2.Text=System.DateTime.Now.Month.ToString();
this.Label1.Text=System.DateTime.Now.Day.ToString();
SqlDataAdapter cmd=new SqlDataAdapter ("select * from me where HDate=this.Label2.Text+"'月"+this.Label1.Text+"日"'",con);
(SELECT COUNT(ID)
FROM Article
WHERE (datediff(D, UpdateTime, getdate())) = 0) AS 今日更新
FROM dbo.Article关键
WHERE (datediff(D, UpdateTime, getdate())) = 0)
youdatatime format:yyyyMMdd
yy=system.DataTime.Now.toString("MMdd");
where substring(convert(char(15),youdataTime),5,4)='"+yy+"'
this.Label1.Text=System.DateTime.Now.Day.ToString();来获取了系统中的月份和日期了。查询语句不会写。还有什么好的方法直接就可以获取系统时间并显示**月**日。
(SELECT COUNT(ID)
FROM Article
WHERE (datediff(D, UpdateTime, getdate())) = 0) AS 今日更新
FROM dbo.Article关键
WHERE (datediff(D, UpdateTime, getdate())) = 0)这个办法也许不是最好的办法,但是确实是一个很好的办法。